enableCache()) { return $builder(); } return $this->getStore()->remember($this->getCacheKey(), null, $builder); } /** * @return bool|void */ public function flushCache() { if (! $this->enableCache()) { return; } return $this->getStore()->delete($this->getCacheKey()); } /** * @return string */ protected function getCacheKey() { return sprintf($this->cacheKey, (int) static::withPermission()); } /** * @return bool */ public function enableCache() { return config('admin.menu.cache.enable'); } /** * Get cache store. * * @return \Illuminate\Contracts\Cache\Repository */ public function getStore() { return Cache::store(config('admin.menu.cache.store', 'file')); } }