Saves some $data in the cache using the last $id
provided to the {@see load()} method.

@param mixed $data
@param int $ttl
777083
public function save($data, $ttl = null)
    {
        if (empty($this->stack)) {
            throw new CacheException("Cache::load() must be called before Cache::save()");
        }
        $id = array_pop($this->stack);
        return $this->add($id, $data, $ttl);
    }
814053
public function set($key, $value, $ttl = 0)
    {
        $this->cache[$key] = new Item($value);
        return true;
    }
680411
public function save($key, $data, $force = false, $ttl = 1440) {
        $ttl = $ttl * 60; // Minutes to Seconds
        // Store result from last query for checking if cache is existing
        // This will avoid locked database error for sqlite3
        $cache_exists = $this->exists($key);

        if (!$cache_exists || $force) {
            $key = $this->_encrypt($key);
            $this->_memcached->set($key, $data, $ttl);
            
            return true;
        }
        
        return false;
    }
1036433
public function set($key, $data, $ttl = null)
    {
        if ($ttl) {
            $now = new \DateTime('now', new \DateTimeZone('UTC'));
            $expire = (int) $now->format('U') + $ttl;
        } else {
            $expire = 0;
        }

        $entry = array(
            'expire' => $expire,
            'value' => $data
        );

        $this->storage[$key] = $entry;

        return true;
    }
642184
public function set($key, $value, $ttl = 0)
    {
        $ttl = $this->fromDefaultTtl($ttl);

        if ($ttl >= 0) {
            if ($this->isAvailable()) {
                $this->redis->set($key, $this->storageDataStructure($value));

                if ($ttl > 0) {
                    $this->redis->expire($key, $ttl);
                }
            }

            $this->setChain($key, $value, $ttl);
        }

        return $this;
    }
554945
public function set_method($identifier, $data, $ttl)
    {
        extract($identifier);

        $directory = $this->_prep_path($class, $method);

        // create a unique field name
        $filename = $this->_hash($args);

        // does a cache exist for this method? If so we leave the ttl
        if ($this->exists($filename, $directory)) {
            $ttl = null;
        }

        return $this->_write($filename, $data, $directory, $ttl);
    }
1296490
public function setTtl($key, $ttl) {
        $redis = $this->_getRedisClient();
        $redis->expire($this->_getInternalKey($key), $ttl);
    }
423972
public function store($key, $data, $ttl=0){
        return $this->connection->set($key, $this->preperaData($data), $ttl);
    }
733295
public function store($prefix, $key, $default, $timestamp, $ttl)
	{
		$value = $this->processDefault($default);

		if ($value === null) {
			return $value;
		}

		$this->driver->set($prefix, $key, $value, $timestamp, $ttl);

		return $value;
	}
98143
protected function writeData($key, $value, $ttl)
    {
        if (!is_numeric($ttl) || $ttl < 0)
            throw new CacheException('TTL invalid: '. $ttl);

        if ($ttl == 0)
            $expiration = "datetime('now', '+100 years')"; // This will make the cache expire after you die, so it's effectively forever.
        else
            $expiration = "datetime('now', '+{$ttl} seconds')";

        return $this->db->queryExec("INSERT OR REPLACE INTO cache (key, value, expire) VALUES ('" . $this->key($key) . "', '".
                                                                                        sqlite_escape_string($value) . "',".
                                                                                        "{$expiration})");
    }
740329
public function do_write($session_id, $data, $ttl)
    {
        $file = $this->_getFileName($session_id);
        $dir = dirname($file);
        if (!@mkdir($dir, 0755, true) && !is_dir($dir)) {
            throw new CreateDirectoryFailedException(['create `:dir` session directory failed: :last_error_message', 'dir' => $dir]);
        }

        if (file_put_contents($file, $data, LOCK_EX) === false) {
            trigger_error(strtr('write `:file` session file failed: :last_error_message', [':file' => $file]));
        }

        @touch($file, time() + $ttl);
        clearstatcache(true, $file);

        return true;
    }
261875
public function save($id, $data, $ttl = null)
    {
        $filedata = [
            'time' => time(),
            'ttl' => $ttl,
            'data' => $data,
        ];
        return false !== file_put_contents($this->filename($id), json_encode($filedata), LOCK_EX);
    }
1166206
protected function doSave($id, $data, $lifeTime = false)
    {
        if (!$lifeTime) {
            $this->cache->forever($id, $data);
        } else {
            $this->cache->put($id, $data, $lifeTime);
        }

        return true;
    }
309292
public function store($key, $value, $ttl = self::DEFAULT_TTL) {
        $this->storage[$key]      =   array('value' => $value, 'expires' => ($ttl) ? time() + $ttl : 0);
        return $value;
    }
300601
function Cache(ttl, dir) {
    // This cache will live forever if ttl is null
  if (typeof ttl !== 'number') {
    ttl = null;
  }
  this.ttl = ttl;
  this.dir = dir;
}
1362402
public function set($key, $data, $ttl = 3600)
    {
        if (empty($this->memcache)) {
            return false;
        }

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

        $compress = !empty($this->compress) ? MEMCACHE_COMPRESSED : 0;

        return $this->memcache->set($key, $data, $compress, $ttl);
    }
313465
public function set($key, $value, $ttl = 0)
    {
        $this->insertToDatabase($key, $value, $ttl);
        $this->setChain($key, $value, $ttl);

        return $this;
    }