说明

    可以用于selectfindvaluecolumn方法,以及其衍生方法,使用cache方法后,在缓存有效期之内不会再次进行数据库查询操作,而是直接获取缓存中的数据

示例

Db::table('think_user')->where('id=5')->cache(true)->find();

指定缓存时间

Db::table('think_user')->cache(true,60)->find();
// 或者使用下面的方式 是等效的
Db::table('think_user')->cache(60)->find();

指定缓存标识

Db::table('think_user')->cache('key',60)->find();

调用缓存标识

$data = \think\Cache::get('key');