Creates or returns an existing method cache.

@return MethodCache
514552
public function getMethodCache()
    {
        if (!$this->methodCache) {
            $this->methodCache = new MethodCache($this->gatherer);
        }

        return $this->methodCache;
    }
976181
public function getCache()
    {
        if (!$this->config->getCache()) {
            // This will be removed eventually. The default cache will be instantiated directly in the config class.
            $this->config->setCache(CacheFactory::get($this->config->getCacheType(), $this->config->getCacheOptions()));
        }

        return $this->config->getCache();
    }
1291093
public function getCacheManager()
    {
        if ($this->cache instanceof Closure) {
            $this->cache = call_user_func($this->cache);
        }

        return $this->cache;
    }
1143161
public function getCache() : FileCache
    {
        if (!$this->cache) {
            $this->cache = Yii::createObject([
                'class'     => FileCache::className(),
                'cachePath' => Yii::getAlias($this->cachePath)
            ]);
        }
        return $this->cache;
    }
63184
private function configCache(): ConfigCache
    {
        if (null === $this->configCache)
        {
            $this->configCache = new ConfigCache($this->getContainerClassPath(), $this->environment->isDebug());
        }

        return $this->configCache;
    }
241270
public function useCache($caching = null)
    {
        if (is_null($caching)) {
            return ($this->useCache && $this->getCache());
        }

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

        return $this;
    }
1132501
public function withMethod($method)
    {
        if ($this->getMethod() === $method) {
            return $this;
        }

        $newInstance = clone $this;
        $newInstance->setMethod($method);
        return $newInstance;
    }
950674
private function cachedAllSimple() {
		if (!isset($this->{__METHOD__})) {
			$this->{__METHOD__} = array_merge($this->cachedI(), $this->cachedGlobalI());
		}
		return $this->{__METHOD__};
	}
994923
public function cacheCallback($method, $args, Closure $callback, $time = null)
    {
        // Cache disabled, just execute query & return result
        if ($this->skippedCache() === true) {
            return call_user_func($callback);
        }

        // Use the called class name as the tag
        $tag = get_called_class();

        return self::getCacheInstance()->tags(['repositories', $tag])->remember(
            $this->getCacheKey($method, $args, $tag),
            $this->getCacheExpiresTime($time),
            $callback
        );
    }
1335092
public function flushCache()
    {
        if (method_exists(app()->make('cache')->getStore(), 'tags')) {
            app()->make('cache')->tags($this->tag)->flush();

            event(implode('-', $this->tag).'.entity.cache.flushed', [$this]);
        }

        return $this;
    }
1073821
public function getCache()
    {
        if (null === self::$cache) {
            if (!empty($this->appConfig['cache']['driver'])) {
                // Options definition.
                if (empty($this->appConfig['cache']['options'])) {
                    $options = array();
                } else {
                    $options = $this->appConfig['cache']['options'];
                }

                // Driver definition.
                if ('memcached' !== $this->appConfig['cache']['driver']) {
                    $className = $this->appConfig['cache']['driver'];
                } else {
                    $className = '\Towel\Cache\TowelMemcached';
                }

                // Driver instantiation
                $cacheDriver = new $className();
                $cacheDriver->setOptions($options);
            }

            self::$cache = new TowelCache($cacheDriver);
        }

        return self::$cache;
    }
393540
public function mergeWith(self $methodCallsBag): self
    {
        $clone = clone $methodCallsBag;
        foreach ($this->methodCalls as $methodCall) {
            $clone->methodCalls[] = $methodCall;
        }

        return $clone;
    }
951496
public function getCache()
    {
        if (null === $this->cache) {
            if (isset($this->options['cache']) && is_string($this->options['cache'])) {
                $this->cache = $this->container->get($this->options['cache']);
            }
        }
        
        return $this->cache;
    }
387080
protected function cacheResults($class, $method, $key, $closure)
    {
        $key = $class.'@'.$method.'.'.$key;

        if (method_exists(app()->make('cache')->getStore(), 'tags')) {
            return app()->make('cache')->tags($this->tag)->remember($key, 60, $closure);
        }

        return call_user_func($closure);
    }
1264539
protected function getMethodReflection($className, $methodName)
    {
        $this->dataCacheNeedsUpdate = true;
        if (!isset($this->methodReflections[$className][$methodName])) {
            $this->methodReflections[$className][$methodName] = new MethodReflection($className, $methodName);
        }
        return $this->methodReflections[$className][$methodName];
    }
1269214
public function getCache() {
    if (!isset($this->cache))
      $this->cache = new \Doctrine\Common\Cache\ArrayCache;
      
    return $this->cache;
  }
75389
private function createCache()
    {
        $cachePath = $this->getCachePath();
        $content   = json_encode([], JSON_PRETTY_PRINT);

        $this->files->put($cachePath, $content);

        return collect(json_decode($content, true));
    }