Cache Save

@param	string	$id	Cache ID
@param	mixed	$data	Data to store
@param	int	$ttol	Length of time (in seconds) to cache the data
@param	bool	$raw	Whether to store the raw value
@return	bool	TRUE on success, FALSE on failure
762028
public function save($id, $data, $ttl = 60, $raw = FALSE)
	{
		$ttl = (int) $ttl;

		return apc_store(
			$id,
			($raw === TRUE ? $data : array(serialize($data), time(), $ttl)),
			$ttl
		);
	}
1168217
public function write($id, $data)
    {
        try {
            $result = $this->db->from($this->table)
                ->where($this->columns['id'])->eq($id)
                ->count();

            if ($result != 0) {
                return (bool) $this->db->update($this->table)
                        ->where($this->columns['id'])->eq($id)
                        ->set(array(
                            $this->columns['data'] => $data,
                            $this->columns['expires'] => time() + $this->maxLifetime,
                ));
            } else {
                return $this->db->insert(array(
                            $this->columns['id'] => $id,
                            $this->columns['data'] => $data,
                            $this->columns['expires'] => time() + $this->maxLifetime
                        ))
                        ->into($this->table);
            }
        } catch (PDOException $e) {
            return false;
        }
    }
247703
public function set($key, $data, $ttl)
    {
        $this->ttl = $ttl;

        $filename = $this->cacheDir . DIRECTORY_SEPARATOR . $this->processKey($key);

        return $this->safelyWriteData($filename, 'w', serialize($data));
    }
802603
public function save($id, $data)
    {
        $file = $this->getFilename($id);

        if (!$this->isWritable($file)) {
            throw new NotWritableException(sprintf('File could not be written to system as target is not writable: %s', $file));
        }

        if ($this->writeData($file, $data) === false) {

            $this->delete($file);

            throw new NotWritableException(sprintf('Data could not be written to file on system. Please make sure that file is writeable: %s', $file));
        }

        return $file;
    }
478136
protected function doWrite($sessionId, $data)
    {
        $item = $this->getCacheItem($sessionId);
        $item->set($data)
            ->expiresAfter($this->ttl);

        return $this->cache->save($item);
    }
359743
public function write($id, $data)
	{
		try
		{
			$query = $this->db->getQuery(true);
			$query->update($this->db->quoteName('#__session'))
				->set($this->db->quoteName('data') . ' = ' . $this->db->quote($data))
				->set($this->db->quoteName('time') . ' = ' . $this->db->quote((int) time()))
				->where($this->db->quoteName('session_id') . ' = ' . $this->db->quote($id));

			// Try to update the session data in the database table.
			$this->db->setQuery($query);

			if (!$this->db->execute())
			{
				return false;
			}

			// Since $this->db->execute did not throw an exception the query was successful.
			// Either the data changed, or the data was identical. In either case we are done.

			return true;
		}
		catch (\Exception $e)
		{
			return false;
		}
	}
579512
public function write($id, $data)
    {
        $writer = $this->db->getWriter();

        $data = [
            $this->options['data_col'] => $data,
            $this->options['time_col'] => (int) time(),
            $this->options['id_col'] => $id,
        ];

        $writer->updateOne($this->options['table'], $data, $this->options['id_col']);

        if ($writer->countAffected()) {
            return true;
        }

        $writer->insertOne($this->options['table'], $data, $this->options['id_col']);

        return true;
    }
10884
public function save($data, $id, $tags = array(), $specificLifetime = false)
    {
        $result = parent::save($data, $id, array(), $specificLifetime);
        if ($tags) {
            if (!method_exists($this->_handle, 'tag_add')) {
                \Zend_Cache::throwException('Method tag_add() is not supported by the PHP memcached extension!');
            }
            foreach ($tags as $tag) {
                $this->_handle->tag_add($tag, $id);
            }
            return true;
        }
        return $result;
    }
510118
public function writeSession($id, $data)
    {
        return (bool)$this->ssdbHandle->setx($this->calculateKey($id), $data, $this->getTimeout());
    }
1059436
public function store($key, $var = null, $ttl = 0)
	{
		$ttl = ($ttl === 0) ? PHP_INT_MAX : time() + $ttl;

		$this->data[$key] = array($var, $ttl);

		return true;
	}
164472
public function writeSession($id, $data)
    {
        // exception must be caught in session write handler
        // http://us.php.net/manual/en/function.session-set-save-handler.php
        try {
            $this->db->getCollection($this->sessionCollection)->update(
                ['id' => $id],
                $this->composeFields($id, $data),
                ['upsert' => true]
            );
        } catch (\Exception $e) {
            Yii::$app->errorHandler->handleException($e);
            return false;
        }

        return true;
    }
294191
public function write($id, $data): bool
    {
        return Proxy\Cache::set($this->prepareId($id), $data, $this->ttl);
    }
101970
public function set($key, $data, $TTL)
    {
        if (empty($this->predis)) return false;

        $key = $this->processKey($key);

        $returnValue = $this->predis->set($key, serialize($data));

        if (!empty($TTL)) {
            $this->predis->expire($key, $TTL);
        }

        return $returnValue;
    }
893209
public function writeSession($id, $data)
    {
        // exception must be caught in session write handler
        // http://us.php.net/manual/en/function.session-set-save-handler.php#refsect1-function.session-set-save-handler-notes
        try {
            $fields = $this->composeFields($id, $data);
            $fields = $this->typecastFields($fields);
            $this->db->createCommand()->upsert($this->sessionTable, $fields)->execute();
        } catch (\Exception $e) {
            Yii::getApp()->errorHandler->handleException($e);
            return false;
        }

        return true;
    }
314171
public static function set($key, $data, $ttl = self::TTL_NO_EXPIRY, $tags = [])
    {
        if (!$cache = self::getInstance()) {
            return false;
        }

        $key = self::prepare($key);
        try {
            $item = $cache->getItem($key);
            $item->set($data);

            if (self::TTL_NO_EXPIRY !== $ttl) {
                $item->expiresAfter($ttl);
            }

            if (!empty($tags)) {
                $item->setTags($tags);
            }

            return $cache->save($item);
        } catch (InvalidArgumentException $e) {
            // something going wrong
            Logger::error($e->getMessage());
        }

        return false;
    }
704166
function save($id, $data)
    {
        $data['_id'] = $id;
        $data['__meta']['sid'] = $this->sid;
        $this->collection->insertOne($data);
    }
886397
public function set($id, $data, $lifetime = 0) {
		try {
			$result = $this->getBackend()->save($this->prepareId($id), $data, $lifetime);
		}
		catch (PhalconCacheException $exception) {
			if ($this->operationsExceptions) {
				throw new OperationFailed('Inserting of the data into the cache failed due to the backend exception occurred: "' . $exception->getMessage() . '"', 0, $exception);
			} else {
				return false;
			}
		}
		
		if ($result === false) {
			if ($this->operationsExceptions) {
				throw new OperationFailed('Inserting of the data into the cache failed, ID: "' . $id . '"');
			} else {
				return false;
			}
		}
		
		return true;
	}