Esempio n. 1
0
 public function testHashGet()
 {
     $client = new Client(array('host' => 'localhost'));
     $connection = $client->createConnection();
     $this->assertTrue($connection);
     $client->hSetNx('testkey', 'testhash', 1);
     $result = $client->hGet('testkey', 'testhash');
     $this->assertEquals(1, $result);
     $client->del('testkey');
 }
Esempio n. 2
0
 /**
  * Cleanups storage.
  */
 public function cleanup()
 {
     $this->client->createConnection();
     $result = $this->client->del($this->lock_key);
     $this->client->close();
     if (!$result && false === headers_sent()) {
         // send a 503
         header('HTTP/1.0 503 Service Unavailable');
         header('Retry-After: 10');
         echo '503 Service Unavailable';
     }
 }