public function clear(CacheAbstract $cache) { $key = new CacheKey('clear', 'it'); $cd = new CacheData($key, 789); $this->assertTrue($cache->storeData($cd)); $cache->clear(); try { $cache->get($key); $this->fail(); } catch (Cachearium\Exceptions\NotCachedException $e) { $this->assertTrue(true); } }
private function dependencies(CacheAbstract $cache) { $this->assertFalse($cache->appendCallback('cacheCallback')); // not in loop $cache->recursivestart('parent', 1); echo 'parent start/'; $this->assertFalse($cache->appendCallback('nawreanaweroi')); // invalid $cache->appendCallback('cacheCallback'); $cache->recursivestart('child', 2); echo '|child first|'; $cache->recursiveend(false); echo 'parent end/'; $cache->recursiveend(false); $data = $cache->get('child', 2); $cachedata = CacheData::unserialize($data); $this->assertEquals('|child first|', $cachedata->stringify($cache)); $data = $cache->get('parent', 1); $cachedata = CacheData::unserialize($data); $this->assertEquals('parent start/aaaa|child first|parent end/', $cachedata->stringify($cache)); $cache->delete('child', 2); $cache->recursivestart('child', 2); echo '|child second|'; $cache->recursiveend(false); $data = $cache->get('child', 2); $cachedata = CacheData::unserialize($data); $this->assertEquals('|child second|', $cachedata->stringify($cache)); $data = $cache->get('parent', 1); $cachedata = CacheData::unserialize($data); $this->assertEquals('parent start/bbbb|child second|parent end/', $cachedata->stringify($cache)); }