예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function put($key, $data, $ttl = 0)
 {
     $this->redis->set($key, is_numeric($data) ? $data : serialize($data));
     if ($ttl !== 0) {
         $this->redis->expire($key, $ttl);
     }
     return true;
 }
예제 #2
0
 /**
  *
  */
 public function testMethodCall()
 {
     $connection = m::mock('mako\\redis\\Connection');
     $connection->shouldReceive('write')->once()->with("*3\r\n\$3\r\nSET\r\n\$1\r\nx\r\n\$1\r\n0\r\n");
     $connection->shouldReceive('gets')->once()->andReturn("+OK\r\n");
     $redis = new Redis($connection);
     $redis->set('x', 0);
 }