/** * 设置缓存 */ public function set($key, $content, $time = null) { if (empty($time)) { $time = $this->_cacheTimeout; } //组装cacheItem对象传递给Hooks函数 $cacheItemObject = new CacheItem(); $cacheItemObject->setKey($key); $cacheItemObject->setValue($content); $cacheItemObject->setTimeout($time); //触发钩子函数 CHooks::callHooks(HOOKS_CACHE_SET, $cacheItemObject); $hookEndContent = $cacheItemObject->getValue(); $endContent = serialize($hookEndContent); return $this->_cacheObject->set($cacheItemObject->getKey(), $endContent, $cacheItemObject->getTimeout()); }