for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Kevinrob\GuzzleCache\Storage;
use Doctrine\Common\Cache\Cache;
use Kevinrob\GuzzleCache\CacheEntry;
class DoctrineCacheStorage implements CacheStorageInterface
{
/**
* @var Cache
*/
protected $cache;
* @param Cache $cache
public function __construct(Cache $cache)
$this->cache = $cache;
}
* {@inheritdoc}
public function fetch($key)
try {
$cache = unserialize($this->cache->fetch($key));
if ($cache instanceof CacheEntry) {
return $cache;
} catch (\Exception $ignored) {
return;
public function save($key, CacheEntry $data)
$lifeTime = $data->getTTL();
if ($lifeTime >= 0) {
return $this->cache->save(
$key,
serialize($data),
$lifeTime
);
// No fail if we can't save it the storage
return false;
public function delete($key)
return $this->cache->delete($key);