Ejemplo n.º 1
0
 public function get($key)
 {
     $full_path = "{$this->path}/{$key}";
     if (file_exists($full_path)) {
         $file = fopen($full_path, 'rb');
         flock($file, LOCK_SH);
         list($expiry_time, $data) = FileCache::parse(file_get_contents($full_path));
         fclose($file);
         if ($this->has_expired($expiry_time)) {
             return $this->refresh($key);
         } else {
             return $data;
         }
     } else {
         return $this->refresh($key);
     }
 }