Example #1
0
 public function testGetMetadats()
 {
     $this->rediska->set('test', array('aaa', time(), 100));
     $this->rediska->expire('test', 100);
     $array = $this->cache->getMetadatas('test');
     $this->assertTrue(is_array($array));
     $this->assertGreaterThan(time(), $array['expire']);
     $this->assertLessThanOrEqual(time(), $array['mtime']);
     $this->assertEquals(array(), $array['tags']);
 }
Example #2
0
 /**
  * @group touch
  */
 public function testTouch()
 {
     $this->cache->save('aaa', 'test_id', array(), 100);
     $reply = $this->cache->touch('test_id', 200);
     $this->assertTrue($reply);
     $meta = $this->cache->getMetadatas('test_id');
     $lifetime = $meta['expire'] - time();
     $this->assertTrue($lifetime >= 299);
     $this->assertTrue($lifetime <= 301);
 }