예제 #1
0
 /**
  * Settings constructor.
  *
  * @param CacheRepository $cache
  * @param Manager         $manager
  */
 public function __construct(CacheRepository $cache, Manager $manager)
 {
     $this->cache = $cache;
     parent::__construct($this->cache->rememberForever(self::CACHE_KEY, function () use($manager) {
         return Entities\Settings::all()->pluck('value', 'name')->all();
     }));
 }
예제 #2
0
파일: JsCompiler.php 프로젝트: clops/core
 /**
  * {@inheritdoc}
  */
 protected function format($string)
 {
     if (!$this->watch) {
         $key = 'js.' . sha1($string);
         $string = $this->cache->rememberForever($key, function () use($string) {
             return $this->minify($string);
         });
     }
     return $string . ";\n";
 }
예제 #3
0
 /**
  * Get an item from the cache, or store the default value forever.
  *
  * @param  string   $key
  * @param  \Closure $callback
  *
  * @return mixed
  */
 public function rememberForever($key, Closure $callback)
 {
     if ($this->enabled) {
         return $this->cache->rememberForever($key, $callback);
     }
     return $callback;
 }
예제 #4
0
 /**
  * Get the page sub title
  *
  * @param string $page
  * @return string
  */
 public function getSubTitle($page)
 {
     $pageFile = $this->getDocumentationPath() . "/{$page}.md";
     return $this->cache->rememberForever("doc_page_{$pageFile}_sub-title", function () use($pageFile) {
         $data = $this->parser->parse($this->finder->get($pageFile));
         return $data->get('subtitle');
     });
 }
예제 #5
0
 /**
  * Get an item from the cache, or store the default value forever.
  *
  * @param string $key
  * @param \Closure $callback
  * @return mixed 
  * @static 
  */
 public static function rememberForever($key, $callback)
 {
     return \Illuminate\Cache\Repository::rememberForever($key, $callback);
 }
예제 #6
0
 /**
  * Get an item from the cache, or store the default value forever.
  *
  * @param  string   $key
  * @param  \Closure  $callback
  * @return mixed
  */
 public function rememberForever($key, Closure $callback)
 {
     if (is_array($key)) {
         return $this->rememberManyForever($key, $callback);
     }
     return parent::rememberForever($key, $callback);
 }