/** * 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(); })); }
/** * {@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"; }
/** * 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; }
/** * 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'); }); }
/** * 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); }
/** * 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); }