Adds the Cache to the Pool

@param      AbstractCacheAdapterInterface  $cache  [description]

@return     Self
334433
public function addCache(AbstractCacheAdapterInterface $cache)
  {
    $this->caches[\strtolower($cache->getDriver())] = $cache;

    return $this;
  }
210646
public static function fromCache($cache)
    {
        if (!is_object($cache)) {
            throw new InvalidArgumentException('Cache must be one of the known cache objects');
        }

        if ($cache instanceof CacheAdapterInterface) {
            return $cache;
        } elseif ($cache instanceof Cache) {
            return new DoctrineCacheAdapter($cache);
        } elseif ($cache instanceof StorageInterface) {
            return new Zf2CacheAdapter($cache);
        } else {
            throw new InvalidArgumentException('Unknown cache type: ' . get_class($cache));
        }
    }
148319
public function addCache(Cache $cache, $prepend = true)
    {
        if ($prepend) {
            \array_unshift($this->caches, $cache);
        } else {
            $this->caches[] = $cache;
        }
    }
76530
protected function cachePool()
    {
        if (!isset($this->cachePool)) {
            throw new RuntimeException(sprintf(
                'Cache Pool is not defined for "%s"',
                get_class($this)
            ));
        }

        return $this->cachePool;
    }
932970
public final function resolve(string $className, CacheInterface $cache = null)
   {
       try {
           if (null !== $cache && $cache->has($className)) {
               return $cache->get($className);
           }
           $reflexion = $this->getReflection($className);
           $args = [];
           if (($constructor = $reflexion->getConstructor())) {
               foreach ($constructor->getParameters() as $param) {
                   $args[] = $this->getArg($param, $cache);
               }
           }
           $instance = $reflexion->newInstanceArgs($args);
           if (null !== $cache) {
               $cache->set($className, $instance);
           }
           return $instance;
       } catch (NotFoundException $e) {
           throw new NotFoundException(
               "Can't resolve " . $className . ": " . $e->getMessage());
       } catch (Throwable $e) {
           throw new ContainerException(
               "Can't resolve " . $className . ": " . $e->getMessage());
       }
   }
638010
public function decorate(&$cache)
    {
        $decorator = $this->copy();
        // reference is necessary for mocks in PHP 4
        $decorator->cache =& $cache;
        $decorator->type = $cache->type;
        return $decorator;
    }
241270
public function useCache($caching = null)
    {
        if (is_null($caching)) {
            return ($this->useCache && $this->getCache());
        }

        $this->useCache = (bool) $caching;

        return $this;
    }
982599
public function set_hyphenator_cache( Hyphenator\Cache $cache ) {
		$this->hyphenator_cache = $cache;

		// Change hyphenator cache for existing token fixes.
		if ( isset( $this->registry ) ) {
			$this->registry->update_hyphenator_cache( $cache );
		}
	}
1324807
public function setCache(\Psr\SimpleCache\CacheInterface $cache, $key, $ttl = 86400)
    {
        $this->cache = $cache;
        $this->cacheKey = $key;
        $this->cacheTime = $ttl;

        if (empty($this->cacheKey))
        {
            $this->cacheKey = 'concatenate-'.md5(serialize($this));
        }

        return $this;
    }
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;
    }
1209283
public function setCacheAdapter(Cache\Adapter\CacheAdapterInterface $cacheAdapter)
    {
        $this->setCachable(true);
        $this->cacheAdapter = $cacheAdapter;

        return $this;
    }
1259337
private function registerCache(ContainerBuilder $container): self
    {
        $container->register('contentful.delivery.cache_clearer', CacheClearer::class)
            ->setAbstract(\true)
        ;

        $container->register('contentful.delivery.cache_warmer', CacheWarmer::class)
            ->setAbstract(\true)
        ;

        return $this;
    }
860800
public function cache(int $minute = 1440): CacheService
    {
        if (empty($this->cache)) {
            $this->cache = new CacheService();
            $this->cache->setRepository($this);
        }

        return $this->cache->setCacheMinute($minute);
    }
1024316
public static function setArrayAccessCache(\ArrayAccess $cache)
    {
        self::$cacheImplementation = new ArrayAccessCacheAdapter($cache);
        self::$hasBeenCleared      = false;
    }
1266721
public function cache($cache = null)
    {
        if ($cache === null) {
            return $this->_cache;
        }

        if ($cache === false) {
            $this->_cache = false;

            return $this;
        }

        if ($cache === true) {
            $cache = 'cake_pdf';
        }

        if (!in_array($cache, Cache::configured())) {
            throw new Exception(sprintf('CakePdf cache is not configured: %s', $cache));
        }

        $this->_cache = $cache;

        return $this;
    }
344273
public function get($cache = null)
    {
        if (is_null($cache)) {
            $cache = $this->getDefaultCache();
        }

        if ($cache instanceof CacheItemPoolInterface) {
            return $cache;
        }
        if ($cache instanceof CacheInterface) {
            return $cache;
        }

        foreach ($this->callbacks as $callBack) {
            $result = call_user_func($callBack, $cache);
            if ($result instanceof CacheItemPoolInterface) {
                return $result;
            }
            if ($result instanceof CacheInterface) {
                return $result;
            }
        }

        throw new InvalidArgumentException(Message::INVALID_CACHE_ADAPTER);
    }
452147
public function setCache(FrontendInterface $cache)
    {
        parent::setCache($cache);
        $this->cacheEntryFileExtension = ($cache instanceof PhpFrontend) ? '.php' : '';
        $this->configureCacheDirectory();
    }