Set the cache driver that will be used.

@param Cache  $cache The cache driver.
@param string $namespace The cache namespace.
516162
public static function setCacheDriver(Cache $cache = null, $namespace = null)
    {
        self::setCache(self::$cacheDriver, $cache, $namespace);
    }
482831
protected function pruneCache($cache)
    {
        if (count($this->cache[$cache]) == $this->maxCacheSize) {
            $this->cache[$cache] = array_slice($this->cache[$cache], $this->maxCacheSize * 0.2);
        }
    }
34828
public function set(Cache $cache, $userName)
    {
        if (!is_writable(dirname($this->getCacheFile($userName)))) {
            throw new CacheException('Cache folder is not writable');
        }

        $data   = serialize($cache);
        $handle = fopen($this->getCacheFile($userName), 'w+');

        fwrite($handle, $data);
        fclose($handle);
    }
745311
public function setCachePath($cachePath='')
    {
        if ($this->cache) {
            if (empty($cachePath)) {
                $this->cachePath = $this->templatesPath.'cache/';
            } else {
                $this->cachePath = $cachePath;
            }
            if (!is_readable($this->cachePath) || !is_writeable($this->cachePath)) {
                $this->error("Template Cache Path ({$this->cachePath}) does not exist or is not readable & writeable.");
            }
        } else {
            $this->cachePath = null;
        }
    }
1236044
public static function initialize($namespace, $config, $cache)
    {
        $context = new self($namespace);
        $context->cache = $cache;
        $context->config = $config;
        $context->prefix = $config->get('app.prefix', null);
        $context->parameters = Parameters::wrap([]);
        self::$instance = $context;
        return $context;
    }
784907
public function clearFrom($namespace, $key = null)
    {
        $oldNamespace = $this->namespace;
        $this->setNamespace($namespace);
        $this->clear($key);
        $this->setNamespace($oldNamespace);
    }
687397
private function setCache(
        string $key, $value, ?int $expires
    ): void {
        $cache = $this->client->getItem($key);
        $cache->set($value);
        $cache->expiresAfter($expires);
        $this->client->save($cache);
    }
452147
public function setCache(FrontendInterface $cache)
    {
        parent::setCache($cache);
        $this->cacheEntryFileExtension = ($cache instanceof PhpFrontend) ? '.php' : '';
        $this->configureCacheDirectory();
    }
338012
public function setCache($key, $value) {
        if($this->cacheEnabled) {
            $this->cacheObj->save($key, $value);
        }
    }
47766
protected function _setCatCache($aCache)
    {
        \OxidEsales\Eshop\Core\Registry::getConfig()->setGlobalParameter('aLocalCatCache', $aCache);
        \OxidEsales\Eshop\Core\Registry::getUtils()->toFileCache('aLocalCatCache', $aCache);
    }
517527
public function addCache(CacheInterface $cache)
    {
        $this->cacheMap[$cache->getName()] = $cache;
        $this->cacheNames[]                = $cache->getName();
    }
116876
public function setNamespace(string $namespace): void
	{
		$storage = $this->getStorage();
		if ($storage instanceof UserStorage) {
			$storage->setNamespace($namespace);
		}
		$this->initIdentity();
	}
205385
public function setDataCache(\TYPO3\CMS\Core\Cache\Frontend\VariableFrontend $dataCache)
    {
        $this->dataCache = $dataCache;
    }
1198875
public function storeCache(array $cache)
    {
        if ($this->store === null) {
            register_shutdown_function([$this, 'saveCacheFile']);
        }

        $this->store = $cache;
    }
1160911
public function setCache($cache)
    {
        if ($cache instanceof Cache ||
            (class_exists('\Doctrine\Common\Cache\CacheProvider') && $cache instanceof \Doctrine\Common\Cache\CacheProvider)
        ) {
            $this->cache = $cache;
            return;
        }

        throw new \Exception('Cache not supported');
    }
477725
public function enableCache($lifetime = 600, CM_Cache_Abstract $cache = null) {
        if (!$cache) {
            $cache = CM_Cache_Shared::getInstance();
        }
        $this->_cache = $cache;
        $this->_cacheLifetime = (int) $lifetime;
    }
774416
public function setCache($useCache, $tableTTL, \Slab\Components\Cache\DriverInterface $cacheObject)
    {
        $this->cacheInterface = $cacheObject;
        $this->cacheTTL = $tableTTL;
        $this->enableCache = $useCache;

        return $this;
    }