public function index(){
// 查询最新的聊天信息
if (!cache('talk_new')) {
# code...
dump('no cache');
$talk_new = Data::with('foot,watermelon,user,dataSelf,likesList')
->withCount('likeslist')
->order('id', 'desc')
->limit(10)
->cache(60)
->select();
cache('talk_new', $talk_new, 60);
}
$this->assign('talk_new', cache('talk_new'));
return view();
} 最佳答案