Returns a new RouteDefinition instance based on the cached values.
@param array $cache The cached RouteDefinition values
@return self A new RouteDefinition instance
343092
public static function createFromCache(array $cache): self
    {
        /** @var self $definition */
        $definition = (new \ReflectionClass(static::class))->newInstanceWithoutConstructor();

        [
            $definition->name,
            $definition->methods,
            $definition->segments,
            $definition->patterns,
            $definition->handler,
            $definition->format,
            $definition->parameterNames,
        ] = $cache;

        return $definition;
    }
11513
protected function setDefaultMetadataCache($cache, ServiceLocatorInterface $serviceLocator)
    {
        $metadataCache = null;

        if (is_string($cache)) {
            if ($serviceLocator->has($cache)) {
                $metadataCache = $serviceLocator->get($cache);
            }
        } else if ($cache instanceof Zend_Cache_Core) {
            $metadataCache = $cache;
        }

        if ($metadataCache instanceof Zend_Cache_Core) {
            Zend_Db_Table::setDefaultMetadataCache($metadataCache);
        }

    }
1307951
public static function factory($routes = array())
    {
        $router = new self();
        if (count($routes)) {
            $router->addRoutes($routes);
        }
        return $router;
    }
892202
public static function createFrom(self $resolving = null, string $key): self
    {
        $instance = null === $resolving ? new self() : $resolving;
        if (false === $instance->has($key)) {
            $instance->add($key);
        }

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

    return $this;
  }
1254999
public function load(Cache $cache, $cacheId)
    {
        if ($cache->contains($cacheId)) {

            /**
             * Cache contains gearman structure
             */
            $this->workerCollection = $cache->fetch($cacheId);

        } else {

            /**
             * Cache is empty.
             *
             * Full structure must be generated and cached
             */
            $this->workerCollection = $this
                ->getGearmanParser()
                ->load()
                ->toArray();

            $cache->save($cacheId, $this->workerCollection);
        }

        return $this;
    }
179569
public function cache(Store $cache = null)
    {
        $cache = $cache ?: $this->resolve(CacheRepository::class)->getStore();

        if ($this->usesCachedClipboard()) {
            $this->guard->getClipboard()->setCache($cache);

            return $this;
        }

        return $this->setClipboard(new CachedClipboard($cache));
    }
758736
final private function getCachedIterator(): CachingIterator
    {
        // If cache is generated, return it
        if (isset($this->iterator)) {
            return $this->iterator;
        }

        // Create and return new CachedIterator from the data
        return $this->iterator = new CachingIterator(

            // The raw data
            new ArrayIterator($this->data),

            // Always use original data and force all items to be cached on read
            CachingIterator::TOSTRING_USE_CURRENT | CachingIterator::FULL_CACHE
        );
    }
328898
public static function createFromArray(array $array): self
    {
        $map = new self;

        foreach ($array as $key => $value) {
            $map->put($key, $value);
        }

        return $map;
    }
1098611
public function registerCacheService()
    {
        $this->app->singleton('cache', function ($app) {
            return new Cache($app['config']);
        });

        $this->app->alias('cache', Cache::class);
    }
852059
public static function getCache($key) {
        $key = static::createCacheKey($key);

        if (static::hasCache($key)) {
            return static::$_cache[$key];
        }

        return null;
    }
179967
private function buildRouteDefinition(CachedReader $reader, \ReflectionClass $controllerReflClass)
    {
        $routeDefinitions = [];

        if ($controllerReflClass->isInstantiable()) {
            $annotations = $reader->getClassAnnotations($controllerReflClass);
            foreach ($annotations as $annotation) {
                if ($annotation instanceof Route) {
                    $annotation->controller = $controllerReflClass->getName();
                    $this->autoDetectEntity($annotation);
                    $routeDefinitions[] = (array)$annotation;
                }
            }

            foreach ($controllerReflClass->getMethods() as $method) {
                $annotations = $reader->getMethodAnnotations($method);
                foreach ($annotations as $annotation) {
                    if ($annotation instanceof Route) {
                        $annotation->controller = $controllerReflClass->getName();
                        $annotation->method = $method->getName();
                        $this->autoDetectEntity($annotation);
                        $routeDefinitions[] = (array)$annotation;
                    }
                }
            }
        }

        return $routeDefinitions;
    }
1024316
public static function setArrayAccessCache(\ArrayAccess $cache)
    {
        self::$cacheImplementation = new ArrayAccessCacheAdapter($cache);
        self::$hasBeenCleared      = false;
    }
929163
public function getter($key, $cache=null)
    {
        $rel = $this;

        return function($object) use ($key, $rel, $cache) {
            return $rel->get($object, $key, $cache);
        };
    }
652997
public static function get(array $configuration = array())
    {
        if (extension_loaded('memcache')) {
            $memcache = new \Memcache();
            $memcache->connect($configuration[CacheKeys::HOST]);
            $cache = new MemcacheCache();
            $cache->setMemcache($memcache);
            return $cache;
        }
    }
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;
    }
814234
public function setMultiple($cache)
    {
        foreach ($cache as $value) {
            $this->set($value['key'], $value['value'], $value['ttl']);
        }

        return $this;
    }