PHP 适用于可变从属页面的简易Kohana缓存
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 适用于可变从属页面的简易Kohana缓存相关的知识,希望对你有一定的参考价值。
protected function checkCacheData($prefix = FALSE, $vars = FALSE) {
if($vars == FALSE) {
$vars = input::instance()->get();
}
if($prefix === FALSE) {
$prefix = Router::$method;
}
if(empty($vars)) {
$cacheKey = 'empty';
} else {
asort($vars);
$queryString = http_build_query($vars);
$cacheKey = md5($queryString);
}
if($cachedData = $this->cache->get(Router::$controller'.'.$prefix.$cacheKey)) {
return $cachedData;
} else {
return FALSE;
}
}
protected function setCacheData($data, $prefix = FALSE, $vars = FALSE) {
if($vars == FALSE) {
$vars = input::instance()->get();
}
if($prefix === FALSE) {
$prefix = Router::$method;
}
if(empty($vars)) {
$cacheKey = 'empty';
} else {
asort($vars);
$cacheKey = md5(http_build_query($vars));
}
$this->cache->set(Router::$controller.'.'.$prefix.$cacheKey, $data);
}
以上是关于PHP 适用于可变从属页面的简易Kohana缓存的主要内容,如果未能解决你的问题,请参考以下文章