thinkphp+memcache缓存例子

public function dailyRelays() {
$history = I('post.history');
$da = new \Home\Model\DailyrelayModel();
if (empty($history) || ($history == 0)) {//今日转发列表
$this->question = $da->getList(session('memberid'),0);
} else if ($history == 1) {//历史转发列表
$cache_name=md5(session('memberid'));
if(S($cache_name)){
G('begin');
$ssss = S($cache_name);
$this->question = $ssss;
G('end');
echo G('begin','end').'s';

}else{
G('begin');
$ssss = $da->getList(session('memberid'),1);
S($cache_name,$ssss,5);
$this->question = $ssss;
G('end');
echo G('begin','end').'s';
}
}
$this->memberid = session('memberid');

$this->display();
}

posted on 2017-03-28 09:11  长不大的菜鸟  阅读(598)  评论(0编辑  收藏  举报

导航