30 public function has($key)
32 if ($this->cache->has($key)) {
33 if (
time() < $this->cache->get($key.
'.expires')) {
37 $this->cache->remove($key.
'.expires');
38 $this->cache->remove($key);
44 public function get($key)
46 return $this->cache->get($key);
49 public function set($key, $value)
51 $this->cache->set($key.
'.expires',
time() + $this->lifetime);
52 $this->cache->set($key, $value);
55 public function remove($key)
57 $this->cache->remove($key.
'.expires');
58 $this->cache->remove($key);
Adds expiration to a cache backend.
__construct(CacheInterface $cache, $lifetime)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
Interface for a cache backend.
has($key)
Checks if the cache has a value for a key.