/** * @covers Xoops\Core\Cache\Access::cacheRead * @covers Xoops\Core\Cache\Access::read * @covers Xoops\Core\Cache\Access::delete */ public function testCacheRead() { $regenFunction = function ($args) { $vars = func_get_args(); return $vars[0]; }; $key = 'testCacheRead'; $value = 'fred'; $ret = $this->object->delete($key); $ret = $this->object->cacheRead($key, $regenFunction, 60, $value); $this->assertEquals($ret, $value); // this should return cached value, not current regenFunction result $ret = $this->object->cacheRead($key, $regenFunction, 60, 'not' . $value); $this->assertEquals($ret, $value); $ret = $this->object->read($key); $this->assertEquals($ret, $value); }
/** * Delete a key from the cache * * @param string $key Identifier for the data * * @return void */ public function delete($key) { $this->cache->delete($this->prefix($key)); }