예제 #1
0
 /**
  * 读取缓存
  */
 public function get($key)
 {
     if (empty($key)) {
         throw new CacheException('[缓存错误]请指定读取缓存的key');
     }
     //直接返回的数据
     $data = $this->_cacheObject->get($key);
     $content = unserialize($data);
     //结果对象
     $cacheItemObject = new CacheItem();
     $cacheItemObject->setKey($key);
     $cacheItemObject->setValue($content);
     //触发获取缓存时的Hooks
     CHooks::callHooks(HOOKS_CACHE_GET, $cacheItemObject);
     //经过HOOKS的数据
     $endContent = $cacheItemObject->getValue();
     return !empty($endContent) ? $endContent : null;
 }