Set the maximum time to live (ttl)

@param int|null $value  Seconds or null to live forever
@throws InvalidArgumentException
4952
protected function setTtlOption(?int $value): void
    {
        if (isset($value) && $value < 1) {
            throw new InvalidArgumentException('ttl cant be lower than 1');
        }

        $this->ttl = $value;
    }
237802
public function set($key, $value, $ttl = null)
    {
        if (null == $ttl) {
            return $this->redis->set($key, $value);
        }

        if (null == $ttl) {
            return $this->redis->set($key, $value);
        }

        if (!is_int($ttl) || 0 >= $ttl) {
            throw new \InvalidArgumentException('The time to live parameter must be an integer and greater than zero.');
        }

        return $this->redis->setex($key, $ttl, $value);
    }
1063432
public function forever($value)
	{
		$cookie = $this->jar->forever($this->getKey(), $value);
		$this->jar->queue($cookie);
	}
55382
public function setTtl($ttl)
    {
        if (!is_null($ttl)) {
            if (!is_numeric($ttl) || (intval($ttl) < 1)) {
                throw new \InvalidArgumentException(sprintf('Invalid TTL: %s', $ttl));
            }

            $this->ttl = intval($ttl);
        } else {
            $this->ttl = null;
        }

        return $this;
    }
488794
public static function set($option, $value)
    {
        if (!array_key_exists($option, self::$conf))
        {
            throw new InvalidArgumentException(sprintf('Unknown option "%s"', $option));
        }

        $expected = gettype(self::$conf[$option]);
        $actual = gettype($value);
        if ($expected != $actual)
        {
            throw new InvalidArgumentException(
                sprintf('Option "%s" has type "%s", but "%s" given',
                    $option, $expected, $actual)
            );
        }

        self::$conf[$option] = $value;
    }
66027
public void setMaxValue(final double VALUE) {
        if (Status.RUNNING == timeline.getStatus()) { timeline.jumpTo(Duration.ONE); }
        if (null == maxValue) {
            if (VALUE < getMinValue()) { setMinValue(VALUE); }
            _maxValue = Helper.clamp(getMinValue(), Double.MAX_VALUE, VALUE);
            setRange(_maxValue - getMinValue());
            if (Double.compare(originalMaxValue, Double.MAX_VALUE) == 0) originalMaxValue = _maxValue;
            if (Double.compare(originalThreshold, getThreshold()) > 0) { setThreshold(Helper.clamp(getMinValue(), _maxValue, originalThreshold)); }

            if (!valueProperty().isBound()) Gauge.this.setValue(Helper.clamp(getMinValue(), getMaxValue(), Gauge.this.getValue()));
            updateFormatString();
            fireUpdateEvent(RECALC_EVENT);
        } else {
            maxValue.set(VALUE);
        }
    }
465358
public function setSignatureTimestamp(\AgentSIB\Diadoc\Api\Proto\Timestamp $value = null)
    {
        $this->SignatureTimestamp = $value;
    }
1056266
public function setWhen($value)
    {
        if (!is_callable($value) && $value !== null) {
            throw new InvalidArgumentException('When parameter must be callable type');
        }
        $this->when = $value;

        return $this;
    }
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;
    }
909052
public function setValue($value)
    {
        if (is_array($value)) {
            if (1 === count($value)) {
                $this->value = $value[0];
            } else {
                throw new \InvalidArgumentException('The argument must either be a string or an array with only one child');
            }
        } else {
            $this->value = $value;
        }
    }
906731
public function setLastReplyIncoming($value)
    {
        if (!is_bool($value))
        {
            throw new InvalidArgumentException($value . " must be true or false.");
        }
        $this->lastReplyIncoming = (boolean)$value;
    }
238018
public function setValue($value)
    {
        if (is_int($value) || is_float($value)) {
            $this->value = $value;
        } else {
            $msg = "The value of a Weight must be a valid integer or float value, '" . gettype($value) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
930207
public function setStatus($value)
    {
        $this->_validateNotNull('Status', $value);
        $this->_validateInt('Status', $value);

        if ($this->data['status'] === $value) {
            return;
        }

        $this->data['status'] = $value;

        $this->_setModified('status');
    }
317601
public function setForwardTimestamp(\AgentSIB\Diadoc\Api\Proto\Timestamp $value = null)
    {
        $this->ForwardTimestamp = $value;
    }
306962
public function setValue($value)
    {
        if (is_numeric($value)) {
            $value = (string) $value;
        }

        if (!is_string($value) && $value !== null) {
            throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($value) ? get_class($value) : gettype($value))));
        }

        $this->node->nodeValue = $value;

        return $this;
    }
231354
public function setCoreLockTtl($value)
    {
        $this->setFieldName('lock_ttl');
        $this->loadObject(true);
        $this->setFieldValue($value);

        return $this;
    }
751508
public function offsetSet($offset, $value)
    {
        $offset = is_string($offset) ? trim($offset) : null;
        if (empty($offset)) throw new \InvalidArgumentException('Offset must be a non empty string.');

        $this->data[$offset] = $value;
    }