/** * @covers Xoops\Core\Cache\Access::clear * @covers Xoops\Core\Cache\Access::write * @covers Xoops\Core\Cache\Access::read */ public function testClear() { $key = 'offhand/name'; $value = 'Fred'; $ret = $this->object->write($key, $value); $this->assertTrue($ret); $ret = $this->object->read($key); $this->assertSame($ret, $value); $ret = $this->object->clear(); $this->assertTrue($ret); $ret = $this->object->read($key); $this->assertFalse($ret); }
/** * Write a value for a key to the cache * * @param string $key Identifier for the data * @param mixed $value Data to be cached - anything except a resource * @param int|DateTime|null $ttl Time to live, integer for ttl in seconds, * DateTime object to expire at a specific time, * or null for * * @return bool True if the data was successfully cached, false on failure */ public function write($key, $value, $ttl = null) { return $this->cache->write($this->prefix($key), $value); }