public function testOutputXcache() { $ready = $this->_prepareXcache(); if (!$ready) { return false; } xcache_unset('_PHCXtest-output'); $time = date('H:i:s'); $frontCache = new Phalcon\Cache\Frontend\Output(array('lifetime' => 2)); $cache = new Phalcon\Cache\Backend\Xcache($frontCache, array('statsKey' => '_PHCM')); ob_start(); //First time cache $content = $cache->start('test-output'); if ($content !== null) { $this->assertTrue(false); } echo $time; $cache->save(null, null, null, true); $obContent = ob_get_contents(); ob_end_clean(); $this->assertEquals($time, $obContent); $this->assertEquals($time, xcache_get('_PHCXtest-output')); //Expect same cache $content = $cache->start('test-output'); if ($content === null) { $this->assertTrue(false); } $this->assertEquals($content, $obContent); $this->assertEquals($content, xcache_get('_PHCXtest-output')); //Query keys $keys = $cache->queryKeys(); $this->assertEquals($keys, array(0 => 'test-output')); //Delete entry from cache $this->assertTrue($cache->delete('test-output')); }