コード例 #1
0
 /**
  * @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;
 }
コード例 #2
0
 /**
  * @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;
 }
コード例 #3
0
 /**
  * @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;
 }
コード例 #4
0
 /**
  * @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;
 }
コード例 #5
0
 /**
  * @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;
 }
コード例 #6
0
 /**
  * @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;
 }
コード例 #7
0
 /**
  * @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;
 }