Пример #1
0
 /**
  * @param $key
  * @return bool
  *
  * @throws CacheException
  */
 public function get($key)
 {
     if (!$this->exists($key)) {
         return false;
     }
     $cache = @file_get_contents($this->getPath($key));
     if ($cache === false) {
         return false;
     }
     set_error_handler(function () {
         throw new CacheException('Unserialization failed.');
     });
     list($value, $expiration) = Driver::unserialize($cache);
     return Driver::isCurrent($expiration) ? $value : false;
 }