<?php

namespace Kevinrob\GuzzleCache\Storage;


use Doctrine\Common\Cache\Cache;
use Kevinrob\GuzzleCache\CacheEntry;

class DoctrineCacheWrapper 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 null;
        }

        return null;
    }

    /**
     * @inheritdoc
     */
    public function save($key, CacheEntry $data)
    {
        try {
            $lifeTime = $data->getTTL();
            if ($lifeTime >= 0) {
                return $this->cache->save(
                    $key,
                    serialize($data),
                    $lifeTime
                );
            }
        } catch (\Exception $ignored) {
            // No fail if we can't save it the storage
        }

        return false;
    }

}
<?php

namespace Kevinrob\GuzzleCache\Storage;


use Doctrine\Common\Cache\Cache;
use Kevinrob\GuzzleCache\CacheEntry;

class DoctrineCacheWrapper 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 null;
        }

        return null;
    }

    /**
     * @inheritdoc
     */
    public function save($key, CacheEntry $data)
    {
        try {
            $lifeTime = $data->getTTL();
            if ($lifeTime >= 0) {
                return $this->cache->save(
                    $key,
                    serialize($data),
                    $lifeTime
                );
            }
        } catch (\Exception $ignored) { }

        return false;
    }

}
--- 
+++ 
@@ -53,7 +53,9 @@
                     $lifeTime
                 );
             }
-        } catch (\Exception $ignored) { }
+        } catch (\Exception $ignored) {
+            // No fail if we can't save it the storage
+        }
 
         return false;
     }
Add comment for empty catch
