Exemplo n.º 1
0
 /**
  * Append specified string to the string stored in specified key.
  *
  * @param string $key
  * @param string $value
  *
  * @return int Size of the value after the append
  * @link http://redis.io/commands/append
  * @example
  * <pre>
  * $redis->set('key', 'value1');
  * $redis->append('key', 'value2'); // 12
  * $redis->get('key'); // 'value1value2'
  * </pre>
  */
 public function append($key, $value)
 {
     try {
         return $this->client->append($key, $value);
     } catch (Exception $e) {
         return $this->handleException($e, __FUNCTION__, func_get_args());
     }
 }
Exemplo n.º 2
0
 /**
  * Test appending a string
  */
 public function testAppend()
 {
     $this->redis->del('testAppend');
     $appendResult = $this->redis->append('testAppend', 'value1');
     $this->assertInternalType('int', $appendResult);
     $this->assertEquals(6, $appendResult);
     $this->assertEquals('value1', $this->redis->get('testAppend'));
     $this->assertEquals(12, $this->redis->append('testAppend', 'value2'));
     $this->assertEquals('value1value2', $this->redis->get('testAppend'));
 }
Exemplo n.º 3
0
 /**
  * Append specified string to the string stored in specified key.
  *
  * @param string $key
  * @param string $value
  *
  * @return int Size of the value after the append
  * @link http://redis.io/commands/append
  * @example
  * <pre>
  * $redis->set('key', 'value1');
  * $redis->append('key', 'value2'); // 12
  * $redis->get('key'); // 'value1value2'
  * </pre>
  */
 public function append($key, $value)
 {
     $this->appendToLog('APPEND ' . $key . ' ' . $value);
     return $this->client->append($key, $value);
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function append($key, $value)
 {
     unset($this->cache[$key]);
     return $this->redis->append($key, $value);
 }