中间省略了设置
缓存的前缀是md5的传入参数
$input = I('get.');
// cache instance
$prefix = 'matching_index' . md5(__METHOD__ . serialize($input));
$Cache = Cache::getInstance('File', array('expire' => '600', 'prefix' => $prefix));
// check cache
if ($user_show = $Cache->get('user_show')) {
var_dump('有缓存的情况');
$total_data = $Cache->get('total_data');
$user_list = $Cache->get('user_list');
$input = $Cache->get('input');
$Page = $Cache->get('page');
} else {
// there is no cache
var_dump('没有缓存的情况');
$stat_show = $this->listShowWithNoCache($Cache);
$total_data = $stat_show['total_data'];
$user_show = $stat_show['user_show'];
$user_list = $stat_show['user_list'];
$input = $stat_show['input'];
$Page = $stat_show['page'];
}
|