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