public function __construct(ContentRepository $content, FlagRepository $flag) { parent::__construct(); $this->content = $content; $this->flag = $flag; if (!user('object')->can('manage_contents')) { $this->middleware('deny403'); } if (!Cache::has('flags')) { //如果推荐位缓存不存在 DataCache::cacheFlags(); } $this->flags = Cache::get('flags'); }
/** * 博客归档,使用cache机制,以加快速度 */ public function getArchive() { if (!Cache::has('archives')) { //如果归档缓存不存在 DataCache::cacheArchive(); } $archives = Cache::get('archives'); $title = '文章归档'; $description = Cache::get('website_title', '芽丝博客') . '-' . $title . ',本博客由 芽丝内容管理框架(YASCMF) 所驱动的博客,基于Laravel实现的内容管理框架,Github地址: https://github.com/douyasi/yascmf 。'; return view('front.archive', compact('archives', 'title', 'description')); }
/** * 重建系统缓存 * 更新内容或者刚安装完本CMS之后,如果数据显示异常,请执行本方法 * * @return Response */ public function getRebuildCache() { SystemOptionCache::cacheStatic(); DataCache::rebuildDataCache(); SettingCache::uncacheSetting(); return view('back.cache.index'); }