示例#1
0
 /**
  * Set the list at index with the new value.
  *
  * @param string $key
  * @param int $index
  * @param string $value
  *
  * @return bool TRUE if the new value is setted. FALSE if the index is out of range, or data type identified by key
  * is not a list.
  * @link http://redis.io/commands/lset
  * @example
  * <pre>
  * $redis->rPush('key1', 'A');
  * $redis->rPush('key1', 'B');
  * $redis->rPush('key1', 'C'); // key1 => [ 'A', 'B', 'C' ]
  * $redis->lGet('key1', 0); // 'A'
  * $redis->lSet('key1', 0, 'X');
  * $redis->lGet('key1', 0); // 'X'
  * </pre>
  */
 public function lSet($key, $index, $value)
 {
     try {
         return $this->client->lSet($key, $index, $value);
     } catch (Exception $e) {
         return $this->handleException($e, __FUNCTION__, func_get_args());
     }
 }
示例#2
0
 /**
  * Set the list at index with the new value.
  *
  * @param string $key
  * @param int $index
  * @param string $value
  *
  * @return bool TRUE if the new value is setted. FALSE if the index is out of range, or data type identified by key
  * is not a list.
  * @link http://redis.io/commands/lset
  * @example
  * <pre>
  * $redis->rPush('key1', 'A');
  * $redis->rPush('key1', 'B');
  * $redis->rPush('key1', 'C'); // key1 => [ 'A', 'B', 'C' ]
  * $redis->lGet('key1', 0); // 'A'
  * $redis->lSet('key1', 0, 'X');
  * $redis->lGet('key1', 0); // 'X'
  * </pre>
  */
 public function lSet($key, $index, $value)
 {
     $this->appendToLog('LSET ' . $key . ' ' . $index . ' ' . $value);
     return $this->client->lSet($key, $index, $value);
 }