Stores a new cached entry.

@param  string       $id       the id of the cached entry
@param  array|object $data     the data for the cached entry to store
@param  int          $lifetime the lifetime to store the entry in seconds
768567
public function save($id, $data, $lifetime = null)
    {
        if ($this->enabled) {
            if ($lifetime === null) {
                $lifetime = $this->getLifetime();
            }
            $this->driver->save($id, $data, $lifetime);
        }
    }
42876
public function write($id, $data) {
    // TODO: Implement locking. b/7701850
    return $this->memcacheContainer->set(
        self::SESSION_PREFIX . $id, $data, $this->expire);
  }
418785
public function write($id, $data)
    {
        $data = [
            $this->options['data_col'] => $data,
            $this->options['time_col'] => (int) time(),
            $this->options['id_col'] => $id,
        ];

        $data = (object) $data;

        $this->db->updateObject($this->options['table'], $data, $this->options['id_col']);

        if ($this->db->getAffectedRows()) {
            return true;
        }

        $this->db->insertObject($this->options['table'], $data, $this->options['id_col']);

        return true;
    }
1339351
public function saveById($id, $data)
    {
        $subData = array();
        foreach (array_keys($this->subAttributeList) as $subKey) {
            $subData[$subKey] = null;
            if (isset($data[$subKey])) {
                $subData[$subKey] = $data[$subKey];
                unset($data[$subKey]);
            }
        }
        $id = parent::saveById($id, $data);
        foreach (array_keys($this->subAttributeList) as $subKey) {
            $this->saveSubAttributeById($id, $subKey, $subData[$subKey]);
        }
        return $id;
    }
1314026
public function save(string $id, array $data)
    {
        $this->setFile($id);
        if ($this->file) {
            if (file_exists($this->file)) {
                $this->update($id, $data);
            } else {
                $this->add($id, $data);
            }
        }
    }
559741
public function write($id, $data): bool
    {
        return $this->handler->set($this->prepareId($id), $data, (int)$this->ttl);
    }
620435
public function set($id, $data, $lifetime = null, $tags = null) {
		$backend = $this->getBackend();
		
		if ($tags !== null) {
			if (! $backend instanceof TaggableInterface) {
				throw new NoTagsSupported('Unable to set the data with the tag(s) due to a tags does not supported by the backend "' . get_class($backend) . '"');
			}
			
			if (is_array($tags)) {
				$tags = array_map([$this, 'prepareId'], $tags);
			} else {
				$tags = $this->prepareId($tags);
			}
		}
		
		$id = $this->prepareId($id);
		
		if ($lifetime === null) {
			$lifetime = $this->_defaultLifetime;
		}
		
		return $backend->set($id, $data, $lifetime, $tags);
	}
62219
public function write($id, $data)
    {
        $session = $this->entityManager->find($this->entityManager, $id);
        if (null === $session) {
            $session = new $this->entityName();
            $session->{$this->primaryKeyColumn} = $id;
        }

        $session->{$this->dataColumn} = $data;
        $session->{$this->lifetimeColumn} = $this->lifetime;
        $session->{$this->modifiedColumn} = time();
        $this->entityManager->persist($session);

        try {
            $this->entityManager->flush();
            return true;
        } catch (\Doctrine\ORM\OptimisticLockException $exc) {
            return false;
        }
    }
1199300
public function write( $id, $data, $next ) {
		$this->_write( $id, $data );

		return $next( $id, $data );
	}
730388
public static function set($id, $data, $cacheLife = 0)
    {
        $instance = self::getInstance();

        $time = time();
        $cache = array();
        $cache['contents'] = $data;
        $cache['expire'] = $cacheLife === 0 ? 0 : $time + $cacheLife;
        $cache['mtime'] = $time;

        $file = $instance->_file($id);

        return $instance->_filePutContents($file, $cache);
    }
90660
public function write($id, $data)
    {  
        return $this->getPersistence()->set(self::KEY_NAMESPACE.$id, $data, (int) ini_get('session.gc_maxlifetime'));
    }
703601
public function write($id, $data)
    {
        if (!$id) {
            return false;
        }
        $expires = time() + $this->_timeout;
        $record = compact('data', 'expires');
        $record[$this->_table->getPrimaryKey()] = $id;
        $result = $this->_table->save(new Entity($record));

        return (bool)$result;
    }
295549
public function write($id, $data) {
        $tmp = $_SESSION;
        session_decode($data);
        $newData  = $_SESSION;
        $_SESSION = $tmp;
        $key      = $this->getKey($id);
        return $this->mem->set($key, json_encode($newData), $this->ttl);
    }
704166
function save($id, $data)
    {
        $data['_id'] = $id;
        $data['__meta']['sid'] = $this->sid;
        $this->collection->insertOne($data);
    }
488625
protected function serialize($data, int $lifetime) : string
    {
        return json_encode(
            ['d' => serialize($data), 't' => time() + $lifetime]
        );
    }
1135662
public function set($id, $data, $lifetime = 0) {
		if ($lifetime === 0) {
			$expire = '0000000000';
		} else {
			$expire = time() + $lifetime;
		}
		
		$options = 0;
		
		if (! is_string($data)) {
			$data = serialize($data);
			$options += self::OPTION_SERIALIZED;
		}
		
		if ($this->compression
		&& ($this->compressionTreshold === 0
		|| ($this->compressionTreshold > 0 && strlen($data) > $this->compressionTreshold))) {
			$data = gzcompress($data, $this->compressionLevel);
			$options += self::OPTION_COMPRESSED;
		}
		
		$options = sprintf('%03d', $options);
		$path    = $this->preparePath($id);
		$content = $expire . ';' . $options . ';' . $data;
		
		$result = file_put_contents($path, $content, LOCK_EX);
		
		if ($result === false) {
			throw new OperationFailed('Unable to puth the cache content to: ' . $path);
		}
		
		return true;
	}
510118
public function writeSession($id, $data)
    {
        return (bool)$this->ssdbHandle->setx($this->calculateKey($id), $data, $this->getTimeout());
    }