示例#1
0
 public function xtestXcacheDecr()
 {
     $ready = $this->_prepareXcache();
     if (!$ready) {
         return false;
     }
     $frontCache = new Phalcon\Cache\Frontend\Output(array('lifetime' => 20));
     $cache = new Phalcon\Cache\Backend\Xcache($frontCache);
     $cache->delete('foo');
     $cache->save('foo', 20);
     $newValue = $cache->decrement('foo');
     $this->assertEquals('19', $newValue);
     $newValue = $cache->decrement('foo');
     $this->assertEquals('18', $newValue);
     $newValue = $cache->decrement('foo', 4);
     $this->assertEquals('14', $newValue);
 }
示例#2
0
 public function testXcacheQueryKeys()
 {
     $ready = $this->_prepareXcache();
     if (!$ready) {
         return false;
     }
     $frontCache = new Phalcon\Cache\Frontend\None(array('lifetime' => 2));
     $cache = new Phalcon\Cache\Backend\Xcache($frontCache);
     $cache->delete('test-output');
     $cache->delete('test-data');
     $cache->save('test-one', 'one');
     $cache->save('test-two', 'two');
     //Query keys
     $keys = $cache->queryKeys();
     $this->assertEquals($keys, array(0 => 'test-one', 1 => 'test-two'));
 }