returns the cache adapter interface for the application cache

@param $cache
@return CacheItemPoolInterface|CacheInterface
@throws \InvalidArgumentException
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);
    }
929163
public function getter($key, $cache=null)
    {
        $rel = $this;

        return function($object) use ($key, $rel, $cache) {
            return $rel->get($object, $key, $cache);
        };
    }
1065515
public function driver(string $driver)
    {
        if (isset($this->drivers[$driver])) {
            $provider = $driver . 'Provider';
            if (method_exists($this, $provider)) {
                return $this->$provider();
            }

            return new $this->drivers[$driver](
                $this->getRequest(),
                $this->config,
                $this->getSession()
            );
        }

        if (class_exists($driver)) {
            $driver = new $driver(
                $this->getRequest(),
                $this->config,
                $this->getSession()
            );

            if ($driver instanceof Two\AbstractProvider) {
                return $driver;
            }
        }

        throw new \InvalidArgumentException("Driver not supported.");
    }
324757
public function getAdapter()
    {
        if ($this->repositoryAdapter instanceof AdapterInterface) {
            return $this->repositoryAdapter;
        }

        foreach ($this->adapters as $adapterClass) {
            if (class_exists($adapterClass) === false || in_array('Accompli\Chrono\Adapter\AdapterInterface', class_implements($adapterClass)) === false) {
                continue;
            }

            $adapter = new $adapterClass($this->repositoryUrl, $this->repositoryDirectory, $this->processExecutor);
            if ($adapter->supportsRepository()) {
                return $adapter;
            }
        }
    }
923599
public function setCache(?CacheInterface $cache)
    {
        if (!$cache) {
            $cache = new VoidCachePool();
        }
        $this->cache = $cache;

        return $this;
    }
1045918
public function get($key, $default = null)
    {
        $cache = $this->adapter->getItem($key);

        return (isset($cache) && $cache !== null) ? $cache : $default;
    }
241270
public function useCache($caching = null)
    {
        if (is_null($caching)) {
            return ($this->useCache && $this->getCache());
        }

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

        return $this;
    }
275604
public function getImporter($key)
    {
        foreach ($this->getImporters(true) as $k => $importer) {
            if ($key === $k) {
                return $importer;
            }
        }
        throw new \InvalidArgumentException(sprintf('Importer could not be found by key `%s`.', $key));
    }
86708
public function setCache($cache) : self
    {
        if (is_string($cache)) {
            $this->cache = CacheFactory::make($cache);
        } elseif ($cache instanceof Cacheable) {
            $this->cache = $cache;
        }

        $prefix = 'tus:' . strtolower((new \ReflectionClass(static::class))->getShortName()) . ':';

        $this->cache->setPrefix($prefix);

        return $this;
    }
42657
public static function get($resolverClass)
    {
        if (!is_string($resolverClass)) {
            throw new InvalidArgumentException('$resolverClass must be a string.');
        }

        if (!array_key_exists($resolverClass, self::$cache)) {
            if (!class_exists($resolverClass)) {
                throw new InvalidArgumentException(
                    sprintf('Resolver class "%s" is not found.', $resolverClass)
                );
            }

            /** @var OptionsResolver $resolver */
            $resolver = new $resolverClass();
            if (!$resolver instanceof self) {
                throw new InvalidArgumentException(
                    sprintf(
                        'Resolver class "%s" must extend "%s".',
                        $resolverClass,
                        self::class
                    )
                );
            }

            $resolver->configureOptions();

            self::$cache[$resolverClass] = $resolver;
        }

        return self::$cache[$resolverClass];
    }
487776
protected function getComposerLock($cache = true)
    {
        $composerLockPath = BASE_PATH . '/composer.lock';
        if (!file_exists($composerLockPath)) {
            return [];
        }

        $lockData = [];
        $jsonData = file_get_contents($composerLockPath);

        if ($cache) {
            $cache = Injector::inst()->get(CacheInterface::class . '.VersionProvider_composerlock');
            $cacheKey = md5($jsonData);
            if ($versions = $cache->get($cacheKey)) {
                $lockData = json_decode($versions, true);
            }
        }

        if (empty($lockData) && $jsonData) {
            $lockData = json_decode($jsonData, true);

            if ($cache) {
                $cache->set($cacheKey, $jsonData);
            }
        }

        return $lockData;
    }
372871
public function getCache()
    {
        if (!isset($this->config['cache'])) {
            throw new InvalidArgumentException('A "cache" file system must be set.');
        }

        if (is_string($this->config['cache'])) {
            return new Filesystem(
                new Local($this->config['cache'])
            );
        }

        return $this->config['cache'];
    }
57626
public function getItem($key)
    {
        if (!$this->isValidEntryIdentifier($key)) {
            throw new InvalidArgumentException('"' . $key . '" is not a valid cache entry identifier.', 1514738649629);
        }

        $rawResult = $this->backend->get($key);
        if ($rawResult === false) {
            return new CacheItem($key, false);
        }

        $value = unserialize($rawResult);
        return new CacheItem($key, true, $value);
    }
121747
protected function getCacheProvider($cacheName)
    {
        $container = $this->getContainer();

        // Try to use user input as cache service alias.
        $cacheProvider = $container->get($cacheName, ContainerInterface::NULL_ON_INVALID_REFERENCE);

        // If cache provider was not found try the service provider name.
        if ( ! $cacheProvider instanceof Cache) {
            $cacheProvider = $container->get('doctrine_cache.providers.' . $cacheName, ContainerInterface::NULL_ON_INVALID_REFERENCE);
        }
        // Cache provider was not found.
        if ( ! $cacheProvider instanceof Cache) {
            throw new \InvalidArgumentException('Cache provider not found.');
        }

        return $cacheProvider;
    }
1105321
public function get($key)
    {
        /** @var \PageCache\Storage\CacheItemInterface $item */
        $item = $this->adapter->get($key);

        if (!$item) {
            return null;
        }

        $this->randomizeExpirationTime($item);

        // Cache expired?
        if ($this->isExpired($item)) {
            return null;
        }

        return $item;
    }
175393
protected final function poolGetItem(string $key): CacheItemInterface
    {
        try {
            $stream = new Stream(
                $this->includePath . $this->getTarget($key),
                Stream::MODE_C_MORE);
            $serialized = $stream->__toString();
            $stream->detach();
            if ($serialized) {
                $item = unserialize($serialized);
                if (is_object($item) && $item instanceof CacheItem) {
                    return $item;
                }
            }
            throw new InvalidArgumentException("Item must implement psr-6");
        } catch (InvalidArgumentException $e) {
            return $this->createItem($key);
        }
    }
811309
public function driver($driver = null)
    {
        $shortener = $this->app['config']['shortener'];

        $driver = $driver ?: $shortener['default'];

        $driverMethod = 'create'.ucfirst($driver).'Driver';

        if (method_exists($this, $driverMethod)) {
            return $this->{$driverMethod}($shortener);
        }

        throw new InvalidArgumentException("Driver [{$driver}] is not supported.");
    }