Esempio n. 1
0
 /**
  * @param $key
  * @return bool|mixed
  */
 protected function getCache($key)
 {
     if ($this->cacheEnabled) {
         return $this->cache->get($this->cachePrefix . $key, false);
     }
     return false;
 }
 /**
  * Gets the raw item underneath a given key, so we can see things about expiry etc
  * @param type $key 
  */
 public function getCacheEntry($key)
 {
     $entry = null;
     if (isset($this->items[$key])) {
         $entry = $this->items[$key];
     } else {
         $data = $this->store->get($key);
         if ($data) {
             $entry = unserialize($data);
         }
     }
     return $entry;
 }
 /**
  * Gets a cached value for a given key
  * @param String $key
  * 			The key to retrieve data for
  */
 public function get($key)
 {
     $entry = null;
     if (isset($this->items[$key])) {
         $entry = $this->items[$key];
     } else {
         $data = $this->store->get($key);
         if ($data) {
             $entry = unserialize($data);
         }
     }
     if (!$entry) {
         return $entry;
     }
     // if the expire time is in the future
     if ($entry->expireAt > time()) {
         return unserialize($entry->value);
     }
     // if we got to here, we need to expire the value
     $this->expire($key);
     return null;
 }