mirror of
https://gitee.com/ulthon/layui-ul.git
synced 2026-07-01 10:32:49 +08:00
修改文章分类的缓存
This commit is contained in:
@@ -178,4 +178,18 @@ class Post extends Model
|
||||
|
||||
return $list_post;
|
||||
}
|
||||
|
||||
public static function quickFind($id,$clear = false)
|
||||
{
|
||||
$cache_key = 'post_'.$id;
|
||||
|
||||
$model_post = Cache::get($cache_key);
|
||||
|
||||
if(empty($model_post) || $clear){
|
||||
$model_post = Post::find($id);
|
||||
Cache::set($cache_key,$model_post,600);
|
||||
}
|
||||
|
||||
return $model_post;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user