Adds a cache that will persist

@param  string $key  The cache key
@param  mixed  $data
@return bool
493390
public static function forever($key, $data)
    {
        if (is_callable($data)) {
            $content = $data();
        } else {
            $content = $data;
        }

        $meta['__bow_meta'] = ['expire_at' => '+'];

        $meta['content'] = $content;

        return (bool) file_put_contents(
            static::makeHashFilename($key, true),
            serialize($meta)
        );
    }
376902
public function exists($key) {
        $key = $this->_encrypt($key);
        $data = $this->_memcached->get($key);
        
        return $data ? true : false;
    }
781756
protected function addToRegistry($data, string $key = null)
    {
        is_null($key) and $key = get_class($data);
        $this->registry[$key] = $data;
    }
767854
public function update(string $key, $data)
	{
		if (is_string($data)) {
			$data = $this->normalizeToCollection($data);
		}

		if ($this->allowed->has($key)) {
			$this->updatePreferencesForKey(
				$key, $this->normalizedTags($data)
			);

			$this->updateCategories(
				$data->pluck('category_id')->unique()
			);
		}

		return $this;
	}
498765
private function save($key, $data)
    {
        $path = $this->getPath($key);

        if (isset($this->locks[$key])) {
            $fp = $this->locks[$key];
            @ftruncate($fp, 0);
            @fseek($fp, 0);
            $len = @fwrite($fp, $data);
            if (\strlen($data) !== $len) {
                @ftruncate($fp, 0);

                return false;
            }
        } else {
            if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) {
                return false;
            }

            $tmpFile = tempnam(\dirname($path), basename($path));
            if (false === $fp = @fopen($tmpFile, 'wb')) {
                @unlink($tmpFile);

                return false;
            }
            @fwrite($fp, $data);
            @fclose($fp);

            if ($data != file_get_contents($tmpFile)) {
                @unlink($tmpFile);

                return false;
            }

            if (false === @rename($tmpFile, $path)) {
                @unlink($tmpFile);

                return false;
            }
        }

        @chmod($path, 0666 & ~umask());
    }
70315
public function put($key, $data)
    {
        $filename = $this->getKeyCode($key);
        $data = json_encode($data);
        $this->write($data, $filename);
    }
1152420
public function writeTo(string $key, $data, array $params = []): bool
    {
        $result = false;

        if ($this->skipCache()) {
            $this->warnings[] = 'Skipping writing to cache';

            return $result;
        }

        $cachedData['data'] = $data;
        $raw = empty($params['raw']) ? false : (bool)$params['raw'];
        if ($raw) {
            if (!array_key_exists('data', $data)) {
                $this->errors[] = "Raw data is missing 'data' key";

                return $result;
            }
            $cachedData = $data;
        }

        $result = CakeCache::write($key, $cachedData, $this->getConfig());
        if (!$result) {
            $this->errors[] = 'Failed to write value to cache';
        }

        return $result;
    }
818496
public function has($key)
    {
        // Got help from here: http://stackoverflow.com/a/3091136/1208233
        if (!$this->memcached->add($key, true, 10)) {
            // If not possible to add, then the key exists
            return true;
        } else {
            // If possible to add, then the key doesn't exist
            $this->memcached->delete($key);
            return false;
        }
    }
351142
public function set($key, $data) {
    $path = $this->getFileName($key, TRUE);
    file_put_contents($path, json_encode($data));
  }
1124401
public function save($key, CacheEntry $data)
    {
        try {
            return wp_cache_set($key, serialize($data), $this->group, $data->getTTL());
        } catch (\Exception $ignored) {
            // Don't fail if we can't save it
        }

        return false;
    }
1132382
public static function has($data, $key)
    {
        if (self::isArrayAccess($data)) {
            return array_key_exists($key, $data);
        }
        if (!is_object($data)) {
            return false;
        }
        if (method_exists($data, 'get' . $key)) {
            return true;
        }
        if (method_exists($data, 'get' . str_replace('_', '', $key))) {
            return true;
        }
        if (isset($data->$key)) {
            return true;
        }

        return false;
    }
928156
public function rememberCache($key, $callback)
    {
        $key = $this->getConfigBasedCachePrefix() . $key;

        return $this->rememberCacheOld($key, $callback);
    }
1063485
public function update($key, $data = null)
    {
        //1. Check if we have data and deal with it!
        if (!is_null($data)) {
            if (!$this->bindData($data)) {
                //we could not save the data
                return false;
            }
        }
    }
684569
public function set($key, $data, $expire = 0, $compress=false) {
		$expire = intval($expire);
		return $this->cache->set($this->prefix.$key, $data, $compress ? MEMCACHE_COMPRESSED : 0, $expire);
	}
239641
public function save(string $key, array $data)
    {
        $this->useRedis(function($resource, $redis) use($key, $data){
            $redis->hset($this->getStoreKey(), $key, $data);
        });
    }
905409
private function store($key, $data) 
    {
        $cachePath = $this->getCachePath($key);
        $cacheDir  = dirname($cachePath);
    
        if(!is_dir($cacheDir) && !@mkdir($cacheDir, 0755, true)) {
            throw new \wf\cache\Exception("Could not make cache directory");
        }
            
        if($this->isCompress && function_exists('gzdeflate') && function_exists('gzinflate')) {
            $data['value'] = gzdeflate($data['value']);
        }
        
        $text = "<?php\n# Auto generate by windwork cache engine,please don't edit me.\nreturn " . var_export($data, true) . ';';
        return @file_put_contents($cachePath, $text);
    }
121746
public function write($key, $data)
    {
        apcu_store($this->_prefix . $key, $data, $this->_ttl);
    }