Load cache
@return cache if existing or not null / null otherwise
979478
private function loadCache()
    {
        if (!is_null($this->cache)) {
            return $this->cache;
        }

        if (file_exists($this->getCacheFile()) && !empty($this->getCacheFile())) {
            $this->cache = json_decode(file_get_contents($this->getCacheFile()), true);
            return $this->cache;
        }
        return null;
    }
700837
public function cache()
    {
        if (!$this->cache) {
            $this->cache = new Manager($this->configure('cache'), $this->taskworker);
        }
        return $this->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;
    }
130117
protected function getDefaultCache()
    {
        if (extension_loaded('apcu')) {
            return new ApcuCachePool();
        }

        if (class_exists('\Cache\Adapter\Filesystem\FilesystemCachePool')) {
            $filesystemAdapter = new Local($this->cacheDir);
            $filesystem        = new Filesystem($filesystemAdapter);
            return new FilesystemCachePool($filesystem);
        }

        return null;
    }
831468
@Nullable
    public V get() {
        if (!valueRetrieved) {
            cacheValue = databaseReader.get();
            valueRetrieved = true;
        }
        return cacheValue;
    }
464212
private function loadConfigFromCache()
    {
        /** @var \Core\Services\Contracts\Config $config */
        $config = DI::getInstance()->get('config');

        /** @noinspection PhpIncludeInspection */
        $config->set(null, require $this->cachedFile);

        return $config;
    }
1148481
private static ResourceCache loadResourceCache() {
        try {
            ResourceCache cache = Bootstrap.getService(ResourceCache.class);
            if (cache == null) {
                cache = new DefaultResourceCache();
            }
            return cache;
        } catch (Exception e) {
            LOG.log(Level.SEVERE, "Error loading ResourceCache instance.", e);
            return new DefaultResourceCache();
        }
    }
886947
@SuppressWarnings("unchecked")
    public static <K,V> Cache<K,V> newNullCache() {
        return (Cache<K,V>) NullCache.INSTANCE;
    }
374226
public function cachedData()
    {
        if (!$this->isCached()) {
            return null;
        }

        $contents = file_get_contents($this->file);

        $serializationEnabled = static::config('serialize');

        $data = $serializationEnabled ? unserialize($contents) : $contents;

        return $data;
    }
376444
protected Object getFromCache(String cacheName, String key) {
        try {
            ICache cache = getCache(cacheName);
            return cache != null ? cache.get(key) : null;
        } catch (CacheException e) {
            LOGGER.warn(e.getMessage(), e);
            return null;
        }
    }
111236
final Cache loadExternalCache(String classSimpleName) {
		ServiceLoader<Cache> cacheLoader = ServiceLoader.load(Cache.class, Para.getParaClassLoader());
		for (Cache cache : cacheLoader) {
			if (cache != null && classSimpleName.equalsIgnoreCase(cache.getClass().getSimpleName())) {
				return cache;
			}
		}
		return null;
	}
1281679
@Override
   public long getCacheGets() {
      Stats stats = cache.getStats();
      return stats.getHits() + stats.getMisses() + unsupportCacheHits.longValue();
   }
275064
protected function getCache()
    {
        return $this->cachingDuration > 0 && $this->cacheID !== false ? Yii::app()->getComponent($this->cacheID) : null;
    }
979388
public function loadFromCache()
    {
        if ($this->items !== null || !$this->cache instanceof Cache) {
            return;
        }

        $data = $this->cache->get($this->cacheKey);
        if (is_array($data) && isset($data[0], $data[1])) {
            list ($this->items, $this->rules) = $data;
            return;
        }

        $query = (new Query)->from($this->itemCollection);
        $this->items = [];
        foreach ($query->all($this->db) as $row) {
            $this->items[$row['name']] = $this->populateItem($row);
        }

        $query = (new Query)->from($this->ruleCollection);
        $this->rules = [];
        foreach ($query->all($this->db) as $row) {
            $this->rules[$row['name']] = unserialize($row['data']);
        }

        $this->cache->set($this->cacheKey, [$this->items, $this->rules]);
    }
1219187
private <T> T loadDataFromCache(final Class<T> clazz, final Object cacheKey, final long maxTimeInCacheBeforeExpiry) throws CacheLoadingException, CacheCreationException {
        return cacheManager.loadDataFromCache(clazz, cacheKey, maxTimeInCacheBeforeExpiry);
    }
567851
protected function load()
	{
		static::$last = array('name' => $this->view, 'path' => $this->path);

		if (isset(static::$cache[$this->path]))
		{
			return static::$cache[$this->path];
		}
		else
		{
			return static::$cache[$this->path] = file_get_contents($this->path);
		}
	}
280313
public function cache()
    {
        if (null === $this->cache) {
            $this->cache = new WebDriver_Cache($this);
        }
        return $this->cache;
    }