Cache the given Nodes.

@param string   $key
@param string[] $nodes
@param int      $ttl TTL in seconds.

@return bool
552716
public function set($key, array $nodes, $ttl)
    {
        $this->records[$key] = ['nodes' => $nodes, 'expire' => time() + $ttl];

        return true;
    }
927735
public function has($key) {
        if (isset($this->store[$key])) {
            if ($this->ttl == 0) {
                return true;
            } else if ($this->store[$key][1] >= (cache::now() - $this->ttl)) {
                return true;
            }
        }
        return false;
    }
1069616
public function set($key, $value, $ttl)
    {
        if ($this->safe) {
            return $this->memcache->set($key, $value, false, $ttl);
        }

        return false;
    }
621782
public function set($key, $value, $ttl = null)
    {
        $this->values[$key] = [];

        $this->values[$key][static::VALUE] = $value;
        $this->values[$key][static::TTL] = $ttl;
        $this->values[$key][static::CREATE_TIME] = time();

        return true;
    }
1207455
public function set($key, $value, $ttl = 2592000)
    {
        if (!self::$instance) {
            self::getInstance();
        }

        $res = NULL;
        // Try to update existing
        if ($this->exists($key)) {
            $res = self::$memcached->set(CFG_DOMAIN . $key, $value, $ttl);
        } else {
            // Set new
            $res = $this->add($key, $value, $ttl);
        }
        return $res;
    }
927254
public function set($key, $value, $ttl = null)
	{
		$this->connect();
        
		$oldKey = $key;
		
		$key = $this->formatKey($key);
		$value = $this->encodeValue($value);
		$ttl = $ttl ? $ttl : $this->options['ttl'];

		$this->driver->set($key, $value, $ttl);
        
		return (bool) ($this->driver->getResultCode() == \Memcached::RES_SUCCESS);
	}
1257091
public function set($key, $value, $ttl = null)
    {
        return $this->_instance->set($key, $value, $ttl);
    }
661269
public function setWithTtl($key, $value, $ttl) {
        if (is_resource($value))
            return false;

        if ($ttl != 0 && $ttl > 2592000) {
            $ttl -= time();
        }
        if ($ttl <= 0)
            return true;

        $key = $this->getUsedKey($key);
        $res = $this->_connection->set($key, $this->esc($value));

        if ($res !== 'OK') {
            return false;
        }

        return ($this->_connection->expire($key, $ttl) == 1);
    }
708722
public function updateDir($key, $ttl)
    {
        if (!$ttl) {
            throw new EtcdException('TTL is required', 204);
        }

        return $this->httpPut($this->getKeyUrl($key), ['ttl' => (int) $ttl], [
            'dir' => 'true',
            'prevExist' => 'true',
        ]);
    }
544096
public static function add(string $key, $data, ?int $ttl = null, array $tags = []) :bool
        {
            if ($tags) {
                foreach ($tags as $arrKey => $tagName) {
                    unset($tags[$arrKey]);

                    $tags[$tagName] = self::tagGetVer($tagName);
                }
            }

            $ttl    = $ttl === null ? self::$ttlDefault : ($ttl > self::$ttlMax ? self::$ttlMax : $ttl);
            $expire = $ttl ? time() + $ttl : 0;

            return self::GetInstance()->add("\$vxnKey:{$key}",
                                            [
                                                '$_data'   => $data,
                                                '$_tags'   => $tags,
                                                '$_ttl'    => $ttl,
                                                '$_expire' => $expire,
                                            ],
                                            null,
                                            $expire);
        }
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;
	}
1329502
public function add($key, $var = null, $ttl = 0)
	{
		if(isset($this->data[$key])) {
			return false;
		}

		return $this->store($key, $var, $ttl);
	}
684608
public function renew($key, $ttl = self::DEFAULT_TTL)
    {
        if (!$this->hasApc) {
            // @codeCoverageIgnoreStart
            return false;
            // @codeCoverageIgnoreEnd
        }

        $val = apc_fetch($key, $fetched);

        if ($fetched) {
            return apc_store($key, $val, $ttl);
        }

        return false;
    }
28932
public function store(Memento\Key $key, $value, $expires = null, $ttl = null)
    {
        $this->__connect($key);

        $hash = null;

        // if no expires specified use default of 5 minutes
        if (!is_numeric($expires)) {
            $expires = self::DEFAULT_EXPIRES;
        }

        // ttl is when the cache is actually okay for deletion
        if (!is_numeric($ttl)) {
            $ttl = $expires;
        }

        // convert to absolute time
        $expires = $expires + time();
        $ttl = $ttl + time();

        // handle arguments based on group or single key
        if ($this->groupKey) {
            $hash = array(
                $this->groupKey->getKey(),
                Memento\Hash::FIELD_VALID,
                serialize(true),
                $key->getKey(),
                serialize($value),
                Memento\Hash::FIELD_EXPIRES,
                $expires,
                Memento\Hash::FIELD_TTL,
                $ttl,
            );
        } else {
            $hash = array(
                $key->getKey(),
                array(
                    Memento\Hash::FIELD_DATA  => serialize($value),
                    Memento\Hash::FIELD_VALID => serialize(true),
                    Memento\Hash::FIELD_EXPIRES  => $expires,
                    Memento\Hash::FIELD_TTL => $ttl,
                )
            );
        }

        if (!is_array($hash)) {
            return false;
        }

        if ($success = call_user_func_array(array($this->redis, 'hmset'), $hash)) {
            $this->setExpires($key, $ttl); // actual redis expires uses ttl value
        }

        return $success;
    }
1059247
public function set($key, $value, $ttl = null): bool
    {
        if ($this->noCache()) {
            return false;
        }
        $this->checkKey($key);
        $this->filterTtl($ttl);
        $result = $ttl === null ?
            $this->getRedis()->set($this->filterKey($key), $value) : 
            $this->getRedis()->set($this->filterKey($key), $value, (int) $ttl);
        if (!$result) {
            trigger_error('Unable to set in redis cache: ' . $this->getRedis()->getLastError());
            return false;
        }
        return true;
    }
1312855
public function store($key, $data, $ttl = 0) {
        return $this->store->store($this->realKey($key), $data, $ttl);
    }
1220329
public function setCache($key, $value, $ttl = 0)
    {
        $cache_function = $this->set_cache_callback;

        return $cache_function($this->cache_type, array('key' => $key, 'value' => $value, 'ttl' => $ttl));
    }