/** * @param $id * @return mixed */ public function getSettings() { $key = md5(getLang() . $this->cacheKey . 'settings'); if ($this->cache->has($key)) { return $this->cache->get($key); } $setting = $this->setting->getSettings(); $this->cache->put($key, $setting); return $setting; }
/** * @param $id * @return bool|mixed */ public function hasChildItems($id) { $key = md5(getLang() . $this->cacheKey . $id . '.has.child'); if ($this->cache->has($key)) { return $this->cache->get($key); } $result = $this->menu->hasChildItems($id); $this->cache->put($key, $result); return $result; }
/** * @return mixed */ public function all() { $key = md5(getLang() . $this->cacheKey . 'all.sliders'); if ($this->cache->has($key)) { return $this->cache->get($key); } $sliders = $this->slider->all(); $this->cache->put($key, $sliders); return $sliders; }
/** * @param $slug * @return mixed */ public function getArticlesBySlug($slug) { $key = md5(getLang() . $this->cacheKey . '.all.tags.slug'); if ($this->cache->has($key)) { return $this->cache->get($key); } $tags = $this->tag->getArticlesBySlug($slug); //$this->cache->put($key, $tags); return $tags; }
/** * @param null $page * @param bool $all * @return mixed */ public function paginate($page = 1, $limit = 10, $all = false) { $allkey = $all ? '.all' : ''; $key = md5(getLang() . $this->cacheKey . '.page.' . $page . '.' . $limit . $allkey); if ($this->cache->has($key)) { return $this->cache->get($key); } $paginated = $this->project->paginate($page, $limit, $all); $this->cache->put($key, $paginated); return $paginated; }
/** * @param $limit * @return mixed */ public function getLastArticle($limit) { $key = md5(getLang() . $limit . $this->cacheKey . '.last'); if ($this->cache->has($key)) { return $this->cache->get($key); } $articles = $this->article->getLastArticle($limit); $this->cache->put($key, $articles); return $articles; }
/** * @param $limit * @return mixed */ public function getLastNews($limit) { $key = md5(getLang() . $limit . $this->cacheKey . '.last'); if ($this->cache->has($key)) { return $this->cache->get($key); } $news = $this->news->getLastNews($limit); $this->cache->put($key, $news); return $news; }