for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author @jayS-de <[email protected]>
*/
namespace Commercetools\Core\Cache;
use Psr\Cache\CacheItemPoolInterface;
class PsrCacheAdapter implements CacheAdapterInterface
{
private $pool;
public function __construct(CacheItemPoolInterface $pool)
$this->pool = $pool;
}
* @param $key
* @param null $options
* @return bool|\string[]
public function has($key, $options = null)
return $this->pool->hasItem($key);
* @param mixed $options
* @return mixed|false
public function fetch($key, $options = null)
$item = $this->pool->getItem($key);
return $item->isHit() ? $item->get() : false;
* @param $data
* @param $lifeTime
* @param $options
* @return bool
public function store($key, $data, $lifeTime = null, $options = null)
$item->set($data);
if (!is_null($lifeTime)) {
$item->expiresAfter($lifeTime);
return $this->pool->save($item);
public function remove($key, $options = null)
return $this->pool->deleteItem($key);