Пример #1
0
 /**
  * Make a new store.
  *
  * @param array $config
  *
  * @throws \InvalidArgumentException
  *
  * @return \AltThree\Storage\Stores\StoreInterface
  */
 public function make(array $config)
 {
     $config = $this->getConfig($config);
     $store = new FlysystemStore($this->flysystem->connection($config['main']));
     if ($config['fallback']) {
         $store = new FallbackStore($store, new FlysystemStore($this->flysystem->connection($config['fallback'])));
     }
     if ($config['compression']) {
         $store = new CompressingStore($store, $this->compressor);
     }
     if ($config['encryption']) {
         if ($config['compression']) {
             throw new InvalidArgumentException('Compression cannot be enabled at the same time as encryption.');
         }
         $store = new EncryptingStore($store, $this->encrypter);
     }
     if ($cache = $config['cache']) {
         $store = new CachingStore($store, $this->cache->store($cache === true ? null : $cache));
     }
     return $store;
 }
 /**
  * @param array $settings
  *
  * @return MemcachedCache
  */
 public function resolve(array $settings = [])
 {
     return new IlluminateCacheAdapter($this->cache->store('memcached'));
 }
Пример #3
0
 public function __construct(CacheFactory $cacheFactory, array $config)
 {
     $this->_cache = $cacheFactory->store($config['cache']);
 }
Пример #4
0
 public function __construct(CacheFactory $cacheFactory, RuleProvider $ruleProvider, array $config)
 {
     $this->_cache = $cacheFactory->store($config['cache']);
     $this->_ruleProvider = $ruleProvider;
 }