Add new enter in the cache system

@param string $key
@param mixed $data
@param int $time

@return bool
357496
public static function add($key, $data, $time = null)
    {
        if (is_callable($data)) {
            $content = $data();
        } else {
            $content = $data;
        }

        $meta['__bow_meta'] = ['expire_at' => $time == null ? '+' : $time];

        $meta['content'] = $content;

        return (bool) file_put_contents(
            static::makeHashFilename($key, true),
            serialize($meta)
        );
    }
549549
public function addKey( $key ) {
		/*
		 * @todo The majority of this method has been copied from
		 * Boldgrid\Library\Library\Notice\KeyPrompt\addKey() because the logic to add a key should
		 * be in this class and not the KeyPrompt class. that KeyPrompt method needs to be refactored.
		 */

		// When adding Keys, delete the transient to make sure we get new license info.
		delete_site_transient( 'bg_license_data' );
		delete_site_transient( 'boldgrid_api_data' );

		$data = $this->callCheckVersion( array( 'key' => $key ) );

		if ( is_object( $data ) ) {
			$this->save( $data, $key );
			return true;
		} else {
			return false;
		}
	}
1195147
public function write($key, $content, $timestamp = null)
    {
        if (!isset($this->cacheDirectory)) {
            return;
        }

        $this->loadCacheMetaData();
        $this->metaData[$key] = $timestamp;
        $this->dirty = true;

        if (!is_dir($this->cacheDirectory)) {
            mkdir($this->cacheDirectory, 0775, true);
        }
        file_put_contents($this->cacheDirectory . '/' . $key, serialize($content));
    }
573849
public final boolean add(final String key, final int exp, final Object value)
      throws TimeoutException, InterruptedException, MemcachedException {
    return this.add(key, exp, value, this.opTimeout);
  }
135286
protected function cacheData($key, $data, $config = [])
    {
        $this->cache->set($key, $data, $config['expire']);
    }
322061
protected function writeCache($key, &$data, $lifetime)
    {
        $this->cacheManager->set($key, $data, [], $lifetime);
    }
70315
public function put($key, $data)
    {
        $filename = $this->getKeyCode($key);
        $data = json_encode($data);
        $this->write($data, $filename);
    }
1012098
protected function _putData($key, $data)
    {
        $bool = $this->_validateDataKey($key, $data);
        if (!$bool) {
            return $this;
        }

        $hasData = $this->has($key);
        if ($this->_setPreparationOn) {
            $data = $this->_dataPreparation(
                $key,
                $data,
                $this->_dataPreparationCallbacks
            );
        }

        if (!$hasData
            || ($hasData && $this->_comparator($this->_DATA[$key], $data, '!=='))
        ) {
            $this->_changeData($key, $data, $hasData);
        }

        return $this;
    }
781604
protected function cacheData(string $key, string $data) : string
    {
        $this->cache[$key] = $data;

        return $data;
    }
683428
private function setItem($key, $value, $time, $expire)
    {
        $cache_file = $this->createCacheFile($key);
        if ($cache_file === false) {
            return false;
        }

        $cache_data = array('data' => $value, 'time' => $time, 'expire' => $expire);
        $cache_data = json_encode($cache_data);

        $put_result = file_put_contents($cache_file, $cache_data);
        if ($put_result === false) {
            return false;
        }

        return true;
    }
1198246
public function setCache($key, $data, $lifetimeInSeconds = false)
    {
        return parent::setCache($this->getHierarchicalKey($key), $data, $lifetimeInSeconds);
    }
384501
public function update_cache($key, $data)
    {
        if ($cache = $this->get_cache_engine()) {
            $cache->set($key, $data);
        }
    }
1185095
public function save($key, $data, \DateTimeInterface $updatedAt = null)
    {
        $keyGen = $this->generateKey($key);
        $path = $this->putFile($keyGen, $data);
        $this->cache->save($keyGen, $updatedAt);
        return $path;
    }
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;
    }
75350
public function set($key, $data) {
        $this->ensure_path_exists();
        $filename = $key.'.cache';
        $file = $this->file_path_for_key($key, true);
        $result = $this->write_file($file, $this->prep_data_before_save($data));
        if (!$result) {
            // Couldn't write the file.
            return false;
        }
        // Record the key if required.
        if ($this->prescan) {
            $this->keys[$filename] = cache::now() + 1;
        }
        // Return true.. it all worked **miracles**.
        return true;
    }
956193
public function add($key, $value, $minutes)
    {
        $this->checkReservedKeyPattern($key);

        $this->setKeywordsOperation(true);

        if ($result = parent::add($key, $value, $minutes)) {
            $this->storeKeywords($key, $minutes, $this->keywords);
        }

        $this->setKeywordsOperation(false);

        $this->resetCurrentKeywords();

        return $result;

    }
1142011
public function store($key, $data, $expires = 0)
    {
        $new_data = [
            'time' => time(),
            'expire' => (int)$expires,
            'data' => serialize($data)
        ];
        if ($this->retrieve($key) !== null) {
            $this->delete($key);
        }
        $cache = $this->loadCache();
        if (is_array($cache)) {
            $cache[(string)$key] = $new_data;
        } else {
            $cache = [(string)$key => $new_data];
        }
        $this->saveCache($cache);
        return $this;
    }