Creates a default cache storage corresponding to $options

@param array $options Cache configuration

@return DefaultCacheStorage
@throws \InvalidArgumentException
437405
private static function createCacheStorage($options)
    {
        $options = array_merge(
            array(
                'adapter' => 'DoctrineCacheAdapter',
                'backend' => array(
                    'class' => 'Doctrine\Common\Cache\FilesystemCache',
                    'args'  => array('%{TEMP}/bartlett/cache'),
                ),
            ),
            $options
        );

        if (!isset($options['adapter'])) {
            throw new \InvalidArgumentException('Adapter is missing');
        }

        $adapterClass = $options['adapter'];

        if (strpos($adapterClass, '\\') === false) {
            // add default namespace
            $adapterClass = __NAMESPACE__ . '\Cache\\' . $adapterClass;
        }
        if (!class_exists($adapterClass)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Adapter "%s" cannot be loaded.',
                    $adapterClass
                )
            );
        }

        if (!isset($options['backend']['class'])) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Backend is missing for %s',
                    $adapterClass
                )
            );
        }
        $backendClass = $options['backend']['class'];

        if (!class_exists($backendClass)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Backend "%s" cannot be loaded.',
                    $backendClass
                )
            );
        }
        $rc = new \ReflectionClass($backendClass);

        if (isset($options['backend']['args'])) {
            $args = self::replaceTokens($options['backend']['args']);
        } else {
            $args = array();
        }

        $backend      = $rc->newInstanceArgs($args);
        $cacheAdapter = new $adapterClass($backend);
        $cache        = new DefaultCacheStorage($cacheAdapter);

        return $cache;
    }
590173
public function setOptions(array $options, array $defaults = [])
    {
        $options = array_merge($defaults, $options);
        $this->options = $options;

        return $this;
    }
490784
public function setOptions(array $options)
    {
        $this->validateOptions($options, $this->type);

        $this->options = $options;

        return $this;
    }
884399
public function setCache(array $options, array $data) {
    array_multisort($options);
    $cache = GroupexFormCache::create([
      'field_gfc_created' => REQUEST_TIME,
      'field_gfc_options' => serialize($options),
      'field_gfc_response' => serialize($data)
    ]);
    $cache->setName('Cache item');
    $cache->save();
  }
805556
public function create($name, $options)
    {
        switch (strtolower($name)) {
            case 'apc':
            case 'apccache':
                $cache = $this->createApc();
                break;
            case 'array':
            case 'arraycache':
                $cache = new ArrayCache();
                break;
            case 'memcache':
            case 'memcachecache':
                $cache = $this->createMemcache($options);
                break;
            case 'memcached':
            case 'memcachedcache':
                $cache = $this->createMemcached($options);
                break;
            case 'redis':
            case 'rediscache':
                $cache = $this->createRedis($options);
                break;
            case 'wincache':
            case 'wincachecache':
                $cache = $this->createWincache();
                break;
            case 'xcache':
            case 'xcachecache':
                $cache = $this->createXcache();
                break;
            default:
                throw new RuntimeException(sprintf('Unnown cache type %s', $name));
        }

        return $cache;
    }
1362786
public function optionsByArray($options) {
		if ($options) {
			$this->options = array_merge($this->options, $options);
		}

		return $this;
	}
435730
protected function applyOptions(array $options)
    {
        isset($options['httpClient']) && $this->httpClient = $options['httpClient'];
        if (!isset($options['metaCacheDir'])) {
            throw new InvalidArgumentException('You must provide option "metaCacheDir"');
        }
        $this->metaCacheDir = $options['metaCacheDir'];
    }
1334226
public function AddContainer($Options) {
      
      $Required = array(
         Gdn_Cache::CONTAINER_LOCATION
      );
      
      $KeyedRequirements = array_fill_keys($Required, 1);
      if (sizeof(array_intersect_key($Options, $KeyedRequirements)) != sizeof($Required)) {
         $Missing = implode(", ",array_keys(array_diff_key($KeyedRequirements,$Options)));
         return $this->Failure("Required parameters not supplied. Missing: {$Missing}");
      }
      
      $CacheLocation = $Options[Gdn_Cache::CONTAINER_LOCATION];
      $CacheLocationOK = Gdn_FileSystem::CheckFolderR($CacheLocation, Gdn_FileSystem::O_CREATE | Gdn_FileSystem::O_WRITE);
      if (!$CacheLocationOK)
         return $this->Failure("Supplied cache folder '{$CacheLocation}' could not be found, or created.");
      
      // Merge the options array with our local defaults
      $Defaults = array(
         Gdn_Cache::CONTAINER_ONLINE      => TRUE,
         Gdn_Cache::CONTAINER_TIMEOUT     => 1
      );
      $FinalContainer = array_merge($Defaults, $Options);
      if ($FinalContainer[Gdn_Cache::CONTAINER_ONLINE]) {
         $this->Containers[] = $FinalContainer;
      }
      
      return Gdn_Cache::CACHEOP_SUCCESS;
   }
108170
private function configureDeliveryOptions(array $options): array
    {
        $logger = $options['options']['logger'];
        if (\null !== $logger) {
            $options['options']['logger'] = \true === $logger
                ? new Reference(LoggerInterface::class)
                : new Reference($options['options']['logger']);
        }

        if (\null !== $options['options']['client']) {
            $options['options']['client'] = new Reference($options['options']['client']);
        }

        $pool = $options['options']['cache']['pool'];
        if (\null !== $pool) {
            $options['options']['cache']['pool'] = \true === $pool
                ? new Reference(CacheItemPoolInterface::class)
                : new Reference($pool);
        }

        return $options;
    }
857331
protected function configureOptions(array $options)
    {
        $resolver = new OptionsResolver();

        $resolver->setDefaults([
            'adapter'          => null,
            'secure'           => true,
            'host'             => self::TMDB_URI,
            'base_url'         => null,
            'token'            => null,
            'session_token'    => null,
            'event_dispatcher' => array_key_exists('event_dispatcher', $this->options) ? $this->options['event_dispatcher'] : new EventDispatcher(),
            'cache'            => [],
            'log'              => [],
        ]);

        $resolver->setRequired([
            'adapter',
            'host',
            'token',
            'secure',
            'event_dispatcher',
            'cache',
            'log'
        ]);

        $resolver->setAllowedTypes('adapter', ['object', 'null']);
        $resolver->setAllowedTypes('host', ['string']);
        $resolver->setAllowedTypes('secure', ['bool']);
        $resolver->setAllowedTypes('token', ['object']);
        $resolver->setAllowedTypes('session_token', ['object', 'null']);
        $resolver->setAllowedTypes('event_dispatcher', ['object']);

        $this->options = $resolver->resolve($options);

        $this->postResolve($options);

        return $this->options;
    }
383159
public function get($name, array $options = array())
    {
        $name = strtolower((string) $name);

        if (!$this->has($name)) {
            throw new InvalidArgumentException(sprintf('Unrecognized compressor "%s"', $name));
        }

        $mapping = $this->getMapping();
        $className = $mapping[$name];

        if ($options === array()) {
            return new $className();
        }

        $reflection = new \ReflectionClass($className);
        return $reflection->newInstanceArgs($options);
    }
513918
public function store($path, $options = [])
    {
        return $this->storeAs($path, $this->hashName(), $this->parseOptions($options));
    }
209627
public function options($options)
    {
        foreach ($this->queries as $query) {
            $query->options($options);
        }

        return $this;
    }
320573
public function AddContainer($Options) {
      
      $Required = array(
         Gdn_Cache::CONTAINER_LOCATION
      );
      
      $KeyedRequirements = array_fill_keys($Required, 1);
      if (sizeof(array_intersect_key($Options, $KeyedRequirements)) != sizeof($Required)) {
         $Missing = implode(", ",array_keys(array_diff_key($KeyedRequirements,$Options)));
         return $this->Failure("Required parameters not supplied. Missing: {$Missing}");
      }
      
      $CacheLocation = GetValue(Gdn_Cache::CONTAINER_LOCATION,$Options);
      
      // Merge the options array with our local defaults
      $Defaults = array(
         Gdn_Cache::CONTAINER_WEIGHT      => 1
      );
      
      $FinalContainer = array_merge($Defaults, $Options);
      $this->Containers[$CacheLocation] = $FinalContainer;
      $PathInfo = explode(':',$CacheLocation);
      
      $ServerHostname = GetValue(0, $PathInfo);
      $ServerPort = GetValue(1, $PathInfo, 11211);
      
      $AddServerResult = $this->Memcache->addServer(
         $ServerHostname,
         $ServerPort,
         GetValue(Gdn_Cache::CONTAINER_WEIGHT, $FinalContainer, 1)
      );
      
      if (!$AddServerResult) {
         $Callback = GetValue(Gdn_Cache::CONTAINER_CALLBACK, $FinalContainer, NULL);
         if (!is_null($Callback))
            call_user_func($Callback, $ServerHostname, $ServerPort);
         
         return Gdn_Cache::CACHEOP_FAILURE;
      }
      
      return Gdn_Cache::CACHEOP_SUCCESS;
   }
799578
public static function createFromOptions(array $options)
    {
        Validate::notNull($options['Name'], 'options[Name]');

        $accessPolicy = new self($options['Name']);
        $accessPolicy->fromArray($options);

        return $accessPolicy;
    }
342895
public function factory(array $options = [])
    {
        if (!array_key_exists(static::ENTITY_MANAGER_NAME, $options)) {
            $errMsg = sprintf('Option %s not found', static::ENTITY_MANAGER_NAME);
            throw new Exception\InvalidArgumentException($errMsg);
        }
        $emName = $options[static::ENTITY_MANAGER_NAME];

        return $this->getServiceLocator()->get($emName);
    }
214881
public function set_options(array $options)
	{
		foreach ($options as $key => $val)
		{
			$this->options[$key] = $val;
		}

		return $this;
	}