/** * Gets the cache engine instance. This method is used when the cache is referenced * with tags. In some cases like if the active cache driver is file, then the tags * method does not work and throws exception. * * @param array $cacheTags * @return mixed */ protected static function getCacheInstance(array $cacheTags) { try { return Cache::tags($cacheTags); } catch (\ErrorException $e) { return Cache::getFacadeRoot(); } }
/** * Get a default cache value, if any is available * * @return Repository|null A default cache value or Null if no default value is available */ public function getDefaultCache() { // By default, the Cache Facade does not return the // any actual cache repository, but rather an // instance of \Illuminate\Cache\CacheManager. // Therefore, we make sure only to obtain its // "store", to make sure that its only the cache repository // instance that we obtain. $manager = Cache::getFacadeRoot(); if (!is_null($manager)) { return $manager->store(); } return $manager; }
/** * Get a default cache factory value, if any is available * * @return Factory|null A default cache factory value or Null if no default value is available */ public function getDefaultCacheFactory() { return Cache::getFacadeRoot(); }