Instantiate cache.

@param Cache|null $cache
@return Cache
184658
protected function instantiateCache(Cache $cache = null)
    {
        if (is_null($this->cache) || ! is_null($cache)) {
            $this->cache = ! is_null($cache)
                ? $cache
                : new Cache($this->config);
        }

        return $this->cache;
    }
408205
public function get()
    {
        if (Cache::has($this->getCacheKey()))
            return Cache::get($this->getCacheKey());

        return $this->create();
    }
1260539
protected function createCache()
    {
        try {
            if (isset($this->parameters[SessionParameter::CACHE_CLASS])) {
                $cache = new $this->parameters[SessionParameter::CACHE_CLASS];
            } else {
                $cache = $this->createDefaultCacheInstance();
            }

            if (!($cache instanceof CacheProvider)) {
                throw new \RuntimeException(
                    sprintf(
                        'Class %s does not subclass %s!',
                        get_class($cache),
                        CacheProvider::class
                    ),
                    1408354124
                );
            }

            return $cache;
        } catch (\Exception $exception) {
            throw new CmisInvalidArgumentException(
                'Unable to create cache: ' . $exception,
                1408354123
            );
        }
    }
134530
public function forceForgetCache()
    {
        return !is_null($this->cache) ? $this->cache->forget($this->cacheKey) : true;
    }
16159
public function cache(){

        $args = \func_get_args();

        switch(\count($args)){
        case 1:
            return $this->helper('cache')->read($args[0]);
        case 2:
            return $this->helper('cache')->write($args[0], $args[1]);
        }

        return null;
    }
280313
public function cache()
    {
        if (null === $this->cache) {
            $this->cache = new WebDriver_Cache($this);
        }
        return $this->cache;
    }
464566
public function delete($cache = null)
    {
        foreach ($this->getModels() as $model) {
            $model->delete($cache);
        }
    }
814234
public function setMultiple($cache)
    {
        foreach ($cache as $value) {
            $this->set($value['key'], $value['value'], $value['ttl']);
        }

        return $this;
    }
458821
public static function get($key)
    {
        if (!self::$instance) return null;

        return self::$instance->cache->get($key);
    }
1208412
private function createCache(array $cache)
    {
        ksort($cache);

        $format = "\t%s => %s," . PHP_EOL;
        $rows = [];

        foreach ($cache as $key => $value) {
            $rows[] = sprintf($format, var_export($key, true), var_export($value, true));
        }

        return sprintf('<?php return [%s];' . PHP_EOL, PHP_EOL . implode('', $rows));
    }
241270
public function useCache($caching = null)
    {
        if (is_null($caching)) {
            return ($this->useCache && $this->getCache());
        }

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

        return $this;
    }
1009641
public function getCacheInstance()
    {
        if (null === $this->cacheInstance) {
            $this->cacheInstance = $this->cacheManager->getCache(self::CACHE_IDENTIFIER);
        }

        return $this->cacheInstance;
    }
276629
public function Caching($Caching = NULL) {
      if (!is_null($Caching))
         $this->UseCaching = (bool)$Caching;
      return $this->UseCaching;
   }
337863
protected function retrieve($key)
    {
        if (($cache = $this->memcache->get($this->key . $key)) !== false) {
            return $cache;
        }

        return null;
    }
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);
    }
443796
public function getCache($cache)
    {
        $cache = self::encodeCache($cache);
        $url = "projects/{$this->project_id}/caches/$cache";
        $this->setJsonHeaders();
        return self::json_decode($this->apiCall(self::GET, $url));
    }
355214
public static function create($paths, $cache = null, $debug = false)
    {
        $wise = new self($debug);

        if ($cache) {
            $wise->setCacheDir($cache);
        }

        $locator = new FileLocator($paths);
        $resolver = new LoaderResolver(
            array(
                new Loader\IniFileLoader($locator),
                new Loader\JsonFileLoader($locator),
                new Loader\PhpFileLoader($locator),
                new Loader\XmlFileLoader($locator),
                new Loader\YamlFileLoader($locator),
            )
        );

        $wise->setCollector(new Resource\ResourceCollector());
        $wise->setLoader(new DelegatingLoader($resolver));

        $resolver->setResourceCollector($wise->getCollector());
        $resolver->setWise($wise);

        return $wise;
    }