thinkphp使用文件缓存的实例

来源:互联网 发布:身份证电子版制作软件 编辑:程序博客网 时间:2024/05/29 21:29


中间省略了设置  

缓存的前缀是md5的传入参数

$input = I('get.');// cache instance$prefix = 'matching_index' . md5(__METHOD__ . serialize($input));$Cache = Cache::getInstance('File', array('expire' => '600', 'prefix' => $prefix));// check cacheif ($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'];}

原创粉丝点击