Register Cache Driver

@param $cacheConfig
@return CacheInterface
489853
protected function registerCache($cacheConfig)
    {
        switch ($cacheConfig['driver']) {
            case 'filesystem':
                $cacheDriver = new FilesystemCache($cacheConfig['dir']);
                break;
            default:
                $cacheDriver = new FilesystemCache(sys_get_temp_dir());
        }

        return $cacheDriver;
    }
1212633
public static function factory($config)
    {
        static $instance = null;

        if (is_string($config)) {
            $config = new FileConfig($config);
        }

        if (! $config instanceof Config) {
            throw new \InvalidArgumentException(
                'the parameter $xmlConfig has to be a path to a config file or an instance of \Wurfl\Configuration\Config'
            );
        }

        if (null === $instance) {
            // Create the cache instance from the configuration
            $cacheStorage = Storage\Factory::create($config->cache);

            // Create the persistent cache instance from the configuration
            $persistenceStorage = Storage\Factory::create($config->persistence);

            $instance = new self($config, $persistenceStorage, $cacheStorage);
        }

        return $instance;
    }
47208
public static function getInstance($Config)
    {
        if (!self::$Instance) {
            self::$Instance = CacheFactory::factory($Config);
        }
        return self::$Instance;
    }
859847
protected function createCacheDriver(string $name): ProviderContract
    {
        $config = $this->config['cache'][$name] ?? [];
        $cache = $this->getCacheRepository($config);

        return $this->createProvider(new Cache($name, $config, $cache));
    }
136957
public function loadFromArray(array $config)
    {
        if (isset($config['domains'])) {
            $this->loadDomainConfiguration($config);
        }

        if (isset($config['general'])) {
            $general = $config['general'];
            $generalConfig = $this->getParsedConfig(
                $general,
                $this->config,
                $this->yamlConfigMap,
                []
            );
            $this->setCache(CacheFactory::get($generalConfig['cacheType'], $generalConfig['cacheOptions']));
            unset($generalConfig['cacheType']);
            unset($generalConfig['cacheOptions']);
            $this->setParsedConfig($generalConfig);
        }

        return $this;
    }
838868
public static function register(array $config=[]) {
        $class = get_called_class();

        self::$o = new $class($config);

        Exception::register();

        self::$o->register and Pool::object(
            'nb\event\Framework',
            Config::$o->register
        );

        Pool::object('nb\event\Framework')->config(self::$o);

        self::$o->import(self::$o->path_autoinclude);

        is_file(self::$o->composer) and require self::$o->composer;
    }
1077181
public function configureCache(ContainerBuilder $container, array $config)
    {
        if (isset($config['caches']['esi'])) {
            $container
                ->getDefinition('sonata.page.cache.esi')
                ->replaceArgument(0, $config['caches']['esi']['token'])
                ->replaceArgument(1, $config['caches']['esi']['servers'])
                ->replaceArgument(3, 3 === $config['caches']['esi']['version'] ? 'ban' : 'purge');
        } else {
            $container->removeDefinition('sonata.page.cache.esi');
        }

        if (isset($config['caches']['ssi'])) {
            $container
                ->getDefinition('sonata.page.cache.ssi')
                ->replaceArgument(0, $config['caches']['ssi']['token']);
        } else {
            $container->removeDefinition('sonata.page.cache.ssi');
        }
    }
184658
protected function instantiateCache(Cache $cache = null)
    {
        if (is_null($this->cache) || ! is_null($cache)) {
            $this->cache = ! is_null($cache)
                ? $cache
                : new Cache($this->config);
        }

        return $this->cache;
    }
929852
public final function register(CacheInterface $container): ServiceInterface
   {
       foreach ($this->service as $key => &$value) {
           $container->set($key, $value);
       }
       return $this;
   }
89835
public static function init(&$config) {
		$controllers = CacheManager::getControllers ();
		foreach ( $controllers as $controller ) {
			CacheManager::$cache->remove( self::getControllerCacheKey ( $controller ));
			$parser = new DiControllerParser ();
			$parser->parse ( $controller, $config );
			$injections = $parser->getInjections ();
			if (sizeof ( $injections ) > 0) {
				self::store ( $controller, $parser->__toString () );
			}
		}
	}
854288
protected function createMemcachedDriver( array $config )
	{
		$prefix = $this->getPrefix( $config );

		$memcached = MemcachedConnector::i()->connect( $config['servers'] );

		return new MemcachedStore( $memcached, $prefix );
	}
546563
public function setCacheProvider(\Doctrine\Common\Cache\Cache $cacheProvider = null)
    {
        $this->cacheProvider = $cacheProvider;

        return $this;
    }
475485
private static function createInstance(string $config): CacheBase
    {
        // 取相应类型的缓存配置要求
        if ($config == 'page') {
            $type = configDefault('none', 'system', 'cachePage');
        } elseif ($config == 'data') {
            $type = configDefault('none', 'system', 'cacheData');
        } elseif ($config == 'must') {
            $type = configDefault('file', 'system', 'cacheMust');
        } else {
            $type = 'none';
        }

        return self::createByType($type);
    }
1337810
protected function createCacheHandler($driver)
    {
        $handler = parent::createCacheHandler($driver);
        if (!$this->validateCacheHandler($driver, $handler)) {
            throw new \UnexpectedValueException('Wrong cache driver found');
        }
        return $handler;
    }
990340
private function getConfigCacheFactory(): ConfigCacheFactoryInterface
    {
        if (!$this->configCacheFactory) {
            $this->configCacheFactory = new ConfigCacheFactory($this->debug);
        }

        return $this->configCacheFactory;
    }
488772
public static function getInstance(AnConfigInterface $config, AnServiceInterface $container)
    {
        if (is_null(self::$_clone)) {
            self::$_clone = new AnRegistry();
        }

        if ($config->key) {
            $config->cache_prefix .= '-'.$config->key;
            unset($config->key);
        }

        if (! isset(self::$_instances[$config->cache_prefix])) {

            $instance = clone self::$_clone;
            self::$_instances[$config->cache_prefix] = $instance;

            $instance->setCachePrefix($config->cache_prefix);
            $instance->enableCache($config->cache_enabled);
        }

        return self::$_instances[$config->cache_prefix];
    }
689884
function addCacheRepository($name, $driver, $config) {
    switch (strtolower($driver)) {
      case 'file':
        $cacheStore = new FileStore(new Filesystem(), $config['path']);
        break;
      case 'apc':
        $cacheStore = new ApcStore(new ApcWrapper());
        break;
      // todo: add memcached, etc.
      default:
        return;
    }
    $this->cacheRepositories[$name] = new Repository($cacheStore);
  }