链式操作cache有什么用

浏览:9151 发布日期:2020/01/06 分类:ThinkPHP6专区
如题,cache在什么情况下使用?
用了它以后,即使下次查询参数不同,也会显示上次查询结果,那么cache有什么用?
代码如下:        $a = CG::where('id',103)->cache('category')->find();
        dump($a->toArray());
        $a = CG::where('id',104)->cache('category')->find();
        dump($a->toArray());
打印如下^ array:8 [▼
  "id" => 103
  "title" => "大学段"
  "pid" => 0
  "status" => 1
  "paixu" => 3
  "delete_time" => null
  "isupdate" => 0
  "beizhu" => null
]

^ array:8 [▼
  "id" => 103
  "title" => "大学段"
  "pid" => 0
  "status" => 1
  "paixu" => 3
  "delete_time" => null
  "isupdate" => 0
  "beizhu" => null
]

^ "aa"
最佳答案
评论( 相关
后面还有条评论,点击查看>>