Saves a value with the given key.

@param string $key
A key.
@param mixed $data
Data to save to the store.
351142
public function set($key, $data) {
    $path = $this->getFileName($key, TRUE);
    file_put_contents($path, json_encode($data));
  }
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)
        );
    }
642053
public function save(array $data, $key)
    {
        $this->redis->set($this->decorateKey($key), $data);
    }
700454
public static function insert($key, $data)
    {
        if (self::$configurator instanceof ConfiguratorClass) {
            return self::$configurator->insert($key, $data);
        } else {
            return null;
        }
    }
314151
public function forget($key)
    {
        if($this->has($key)) {
            array_forget($this->data, $key);
        }

        $this->persist();
    }
812643
protected function save(array &$keys, &$data, $value)
    {
        $key = array_shift($keys);

        if (! isset($data[$key]))
        {
            $data[$key] = array();
        }

        if (empty($keys))
        {
            return $data[$key] = $value;
        }

        return $this->save($keys, $data[$key], $value);
    }
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;
    }
972765
protected function checkKeyExists($data, $key)
    {
        if (!$data->has($key)) {
            $this->output->writeln("<error>The key $key does not exist.");

            return false;
        }

        return true;
    }
1068117
public function setData($data, $key = '', $merge = false)
    {
        if ($key) {
            if ($merge && !empty($this->data[$key])) {
                $this->data[$key] = array_merge($this->data[$key], (array) $data);
            } else {
                $this->data[$key] = $data;
            }
        } else {
            if (is_object($data)) {
                $data = get_object_vars($data);
            }
            if (is_array($data)) {
                $this->data = array_merge($this->data, $data);
            }
        }
    }
977037
public function write($key, $data)
    {
        $this->_cachedData[$key] = $data;
        Cache::set('model-metadata', $this->_cachedData, Cache::TTL_ONE_MONTH);
    }
1287465
protected function addData($key, $data = null)
    {
        $this->data[self::RS_KEY_DATA]->{$key} = $data;
    }
708183
public function push($key, $data) {
		$keysData = $this->getKeysData();
		$this->clearExpiredKeys($keysData);
		$keysData[$key] = array(
			'time' => time(),
			'data' => $data
		);
		$this->saveKeysData($keysData);
	}
1362422
public function save($key, $data)
	{
		$hash = md5($key);
		$cacheFile = $this->getPath().'/'.$hash.'.cache';

		return file_put_contents($cacheFile, serialize($data));
	}
917748
public function setDataByKey($key, $data)
    {
        $data = $this->hydrateIfJsonToArray($data);
        $this->data[$key] = $data;
    }
887801
public function save($key, $data, $lifeTime)
    {
        $this->_server->set($this->_namespace . '_' . $key, $data);
        return true;
    }
1357525
public function set($key, $value) {
		if (null === $key) {
			$this->_data[] = $value;
		} else {
			$this->_data[$key] = $value;
		}
	}
722257
protected function parseSchema($data, $key)
    {
        $this->parseDefined($key);

        if (array_key_exists(self::REQUIRED_KEY, $data)) {
            $this->parseRequired(
                $key,
                $data[self::REQUIRED_KEY]
            );
        }

        if (array_key_exists(self::DEFAULT_VALUE, $data)) {
            $this->parseDefault(
                $key,
                $data[self::DEFAULT_VALUE]
            );
        }
    }