Save data for the given key.

@param string $key  The store key
@param string $data The data to store

@return bool
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());
    }
125326
public function set(string $key, $data)
    {
        $this->assertLocked();

        $this->data[$key] = $data;
    }
778788
public function push(string $key, $data, bool $override = false)
    {
        if (!array_key_exists($key, $this->data) || $override) {
            $this->data[$key] = $data;

            return $this->data[$key];
        }

        return false;
    }
115708
public function updatePreferences(string $key, $data)
    {
        $current = $this->preferences;

        $this->preferences = PreferencesParser::parse($current)->update($key, $data)->toJson();

        $this->save();
    }
672450
public function save($key, $data, $lifeTime)
    {
        //zapis w APC
        \apcu_store($this->_namespace . $key, $data, $lifeTime);
        return true;
    }
1313834
public static function push($key, $data)
    {
        if (is_callable($data)) {
            $content = $data();
        } else {
            $content = $data;
        }

        static::$with_meta = true;

        $cache = static::get($key);

        static::$with_meta = false;

        if (is_array($cache['content'])) {
            array_push($cache['content'], $content);
        } else {
            $cache['content'] .= $content;
        }

        return (bool) file_put_contents(
            static::makeHashFilename($key),
            serialize($cache)
        );
    }
272977
function set($key, $data)
    {
        $this->cache[$key]         = $data;
        $this->cache_changes[$key] = true;
    }
121746
public function write($key, $data)
    {
        apcu_store($this->_prefix . $key, $data, $this->_ttl);
    }
904545
public function encrypt($data, $key) {
        if ($data === '') {
            return $data;
        }

        $cipher = $this->createCipher($key);

        $encrypted = mcrypt_generic($cipher, $data);

        $this->clearCipher($cipher);

        return $encrypted;
    }
287818
public static function has(array $data, $key)
	{
		foreach (explode('.', $key) as $segment) {
			if (!is_array($data)) {
				return false;
			}

			if (!array_key_exists($segment, $data)) {
				return false;
			}

			$data = $data[$segment];
		}

		return true;
	}
972765
protected function checkKeyExists($data, $key)
    {
        if (!$data->has($key)) {
            $this->output->writeln("<error>The key $key does not exist.");

            return false;
        }

        return true;
    }
859976
public function save($table, $data, $keys, $options = []) {
		return $this->object->save($table, $data, $keys, $options);
	}
642053
public function save(array $data, $key)
    {
        $this->redis->set($this->decorateKey($key), $data);
    }
840900
public function save($key, $data, $timeout)
    {
        $callable = $this->options['save'];

        if (!is_callable($callable)) {
            return false;
        }

        return call_user_func_array($callable, array($key, $data, $timeout));
    }
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;
    }
405590
public function setData($key, $data, $registry = null)
	{
		if ($registry == null) {
			$registry = $this->default;
		}
		if (is_string($key . $registry) && $this->registryExists($registry)) {
			$this->data[self::REGISTRY][$registry][$key] = $data;
			$this->dirty = true;
			return true;
		}
		return false;
	}
208410
public function save($key, $data, $lifeTime)
    {
        //$lifeTime nie jest używany w tym backendzie
        //zapis pliku
        file_put_contents($this->_cache->getConfig()->path . '/' . $key, $data);
        return true;
    }