예제 #1
0
 public function testGetLifetime()
 {
     $this->key->getRediska()->set($this->key->getName(), 1);
     $this->key->getRediska()->expire($this->key->getName(), 50);
     $reply = $this->key->getLifetime();
     $this->assertGreaterThan(45, $reply);
 }
예제 #2
0
파일: Basic.php 프로젝트: utachkin/Rediska
 public function testDecrement()
 {
     $this->key->getRediska()->set($this->key->getName(), 123);
     $reply = $this->key->decrement(2);
     $this->assertEquals(121, $reply);
     $reply = $this->key->getRediska()->get($this->key->getName());
     $this->assertEquals(121, $reply);
 }
예제 #3
0
 public function testAppend()
 {
     $this->key->setValue('abc');
     $reply = $this->key->append('abc');
     $this->assertEquals(6, $reply);
     $reply = $this->key->getRediska()->get($this->key->getName());
     $this->assertEquals('abcabc', $reply);
 }
예제 #4
0
 public function testSetExpireTimestamp()
 {
     $time = time() + 1;
     $this->key->setExpire($time, true);
     $expire = $this->key->getExpire();
     $this->assertEquals($time, $expire);
     $this->assertTrue($this->key->isExpireTimestamp());
     $this->key->setValue(1);
     sleep(2);
     $reply = $this->key->getRediska()->get($this->key->getName());
     $this->assertNull($reply);
 }