Exemplo n.º 1
0
 /**
  * Empty all views linked to a tag or the complete partial cache.
  * Note: Only supported by Taggable cache drivers.
  *
  * @param string $tag
  *
  * @throws \Spatie\PartialCache\Exceptions\MethodNotSupportedException
  */
 public function flush($tag = null)
 {
     if (!$this->cacheIsTaggable) {
         throw new MethodNotSupportedException('The cache driver (' . get_class($this->cacheManager->driver()) . ') doesn\'t support the flush method.');
     }
     $tag = $tag ?: $this->cacheKey;
     $this->cache->tags($tag)->flush();
 }
Exemplo n.º 2
0
 /**
  * Get the cache client.
  *
  * @param string[] $config
  *
  * @return \Illuminate\Contracts\Cache\Store
  */
 protected function getClient(array $config)
 {
     $name = array_get($config, 'connector');
     return $this->cache->driver($name)->getStore();
 }
 /**
  * Construct a new File loader.
  *
  * @param  \Illuminate\Contracts\Foundation\Application  $app
  * @param  \Illuminate\Contracts\Cache\Repository  $cache
  * @param  \Illuminate\Filesystem\Filesystem  $files
  */
 public function __construct(Application $app, Cache $cache, Filesystem $files)
 {
     $this->app = $app;
     $this->cache = $cache->driver('file');
     $this->files = $files;
 }