Create an instance of the Memcached cache driver.

@return \Nova\Cache\MemcachedStore
344444
protected function createMemcachedDriver()
    {
        $servers = $this->app['config']['cache.memcached'];

        $memcached = $this->app['memcached.connector']->connect($servers);

        return $this->repository(new MemcachedStore($memcached, $this->getPrefix()));
    }
220405
protected function createMemcachedStore()
    {
        $serverArray    = $this->config['servers'];
        $persistent     = boolval($this->config['persistent']);
        $name           = trim($this->config['server_name']);
        $prefix         = trim($this->config['prefix']);

        if ($persistent && (strlen($name) > 0)) {
            $memcached  = new Memcached($name);
        } else {
            $memcached  = new Memcached();
        }

        if (!sizeof($memcached->getServerList())) {
            $memcached->addServers($serverArray);
        }

        return new MemcachedStore($memcached, $prefix);
    }
1107343
public function cache_driver()
	{
		if ( ! $this->_cache)
		{
			$adapter = new DCache_Adapter\File(
				realpath(__DIR__.'../../../'.static::CACHE_DIR)
			);
			$adapter->setOption('ttl', static::CACHE_LIFETIME);
			$this->_cache = new DCache\Cache($adapter);
		}

		return $this->_cache;
	}
899951
public static function getInstance() {
		if (is_null(self::$_instance)) {
			$id_cache = is_memcache_available() ? new Memcache() : new FileCache();
			self::$_instance = new self($id_cache);
		}
		return self::$_instance;
	}
496227
protected function createCacheHandler($driver)
    {
        $minutes = $this->app['config']['session.lifetime'];

        return new CacheBasedSessionHandler($this->app['cache']->driver($driver), $minutes);
    }
930396
protected function createMemcachedDriver(array $config)
    {
        $prefix = $this->getPrefix($config);

        // Extract Plus features from config
        $persistentConnectionId = array_get($config, 'persistent_id');
        $customOptions = array_get($config, 'options', []);
        $saslCredentials = array_filter(array_get($config, 'sasl', []));

        $memcached = $this->app['memcached.connector']->connect(
            $config['servers'],
            $persistentConnectionId,
            $customOptions,
            $saslCredentials
        );

        return $this->repository(new MemcachedStore($memcached, $prefix));
    }
775631
protected static function _initializeCache()
    {
        if ( !static::$_options[CoreSettings::ENABLE_CACHE] )
        {
            return false;
        }

        //  Try memcached
        try
        {
            return static::$_cache = Flexistore::createMemcachedStore( array('host' => 'localhost') );
        }
        catch ( \Exception $_ex )
        {
        }

        //  Try memcache
        try
        {
            return static::$_cache = Flexistore::createMemcacheStore( array('host' => 'localhost') );
        }
        catch ( \Exception $_ex )
        {
        }

        //  Find me a cache path!
        if ( false === ( $_path = static::_getCachePath() ) )
        {
            return false;
        }

        //  Try files
        return static::$_cache = Flexistore::createFileStore( $_path );
    }
1174172
public function createRoot()
    {
        $instance = new CachedConfigCollection();

        // Override nested config to use delta collection
        $instance->setNestFactory(function ($collection) {
            return DeltaConfigCollection::createFromCollection($collection, Config::NO_DELTAS);
        });

        // Create config cache
        if ($this->cacheFactory) {
            $cache = $this->cacheFactory->create(CacheInterface::class . '.configcache', [
                'namespace' => 'configcache'
            ]);
            $instance->setCache($cache);
        }

        // Set collection creator
        $instance->setCollectionCreator(function () {
            return $this->createCore();
        });

        return $instance;
    }
1305593
protected function createCacheStore($config)
    {
        if ($config === true) {
            return new MemoryStore;
        }
        return new Cache(Yii::$app->cache,
            $config['prefix'] ?? 'flysystem',
            $config['duration'] ?? null
        );
    }
65072
public function save()
    {
        if (null !== $this->cache) {
            $this->loadConfig(null);
            $this->cache->save($this->pool);
        }
        return $this;
    }
1174791
public function build()
    {
        $annotationReader = $this->annotationReader;
        if (null === $annotationReader) {
            $annotationReader = new AnnotationReader();
            if (null !== $this->cacheDirectory) {
                $cacheDirectory = sprintf('%s/annotations', $this->cacheDirectory);

                $this->createDirectory($cacheDirectory);
                $annotationReader = new CachedReader($annotationReader, new FilesystemCache($cacheDirectory));
            }
        }

        $metadataDriver  = $this->driverFactory->createDriver($this->metadataDirectories, $annotationReader);

        $metadataFactory = new MetadataFactory($metadataDriver, null, $this->debug);
        $metadataFactory->setIncludeInterfaces($this->includeInterfaceMetadata);

        if (null !== $this->cacheDirectory) {
            $directory = sprintf('%s/metadata', $this->cacheDirectory);

            $this->createDirectory($directory);
            $metadataFactory->setCache(new FileCache($directory));
        }

        return new OpenGraphGenerator($metadataFactory);
    }
1152051
public function getCacheStore(): ?Store
    {
        if (!$this->hasCacheStore()) {
            $this->setCacheStore($this->getDefaultCacheStore());
        }
        return $this->cacheStore;
    }
63184
private function configCache(): ConfigCache
    {
        if (null === $this->configCache)
        {
            $this->configCache = new ConfigCache($this->getContainerClassPath(), $this->environment->isDebug());
        }

        return $this->configCache;
    }
1327960
public function setDriver(\BearFramework\App\ICacheDriver $driver): self
    {
        if ($this->driver !== null) {
            throw new \Exception('A cache driver is already set!');
        }
        $this->driver = $driver;
        return $this;
    }
180510
protected function createDatabaseDriver()
    {
        $connection = $this->getDatabaseConnection();

        $encrypter = $this->app['encrypter'];

        // We allow the developer to specify which connection and table should be used
        // to store the cached items. We also need to grab a prefix in case a table
        // is being used by multiple applications although this is very unlikely.
        $table = $this->app['config']['cache.table'];

        $prefix = $this->getPrefix();

        return $this->repository(new DatabaseStore($connection, $encrypter, $table, $prefix));
    }
420272
public function build(): SetCacheDisabledRequest
	{
		$instance = new SetCacheDisabledRequest();
		if ($this->cacheDisabled === null) {
			throw new BuilderException('Property [cacheDisabled] is required.');
		}
		$instance->cacheDisabled = $this->cacheDisabled;
		return $instance;
	}
915267
protected function createCacheHandler($driver)
    {
        $store = $this->app['config']->get('session.store') ?: $driver;

        $minutes = $this->app['config']['session.lifetime'];

        return new CacheBasedSessionHandler(clone $this->app['cache']->store($store), $minutes);
    }