Set TTL in {@code milliseconds} after restoring the key.

@param ttl time to live.
@return {@code this}.
493901
public RestoreArgs ttl(Duration ttl) {

        LettuceAssert.notNull(ttl, "Time to live must not be null");

        return ttl(ttl.toMillis());
    }
44233
function (key, val, ttl, callback) {
            //ttl is optional
            if (_.isFunction(ttl)) {
                callback = ttl;
                ttl = undefined;
            }

            //callback is optional
            callback = callback || _.noop;
            client.set(key, val, ttl, callback);
        }
241790
def update_ttl(self, ttl):
        """"""

        if len(self) == 0:
            self.ttl = ttl
        elif ttl < self.ttl:
            self.ttl = ttl
934048
protected void setInternal(Object key, Data value, long ttl, TimeUnit timeunit, long maxIdle, TimeUnit maxIdleUnit) {
        Data keyData = toDataWithStrategy(key);
        MapOperation operation = operationProvider.createSetOperation(name, keyData, value,
                timeInMsOrOneIfResultIsZero(ttl, timeunit), timeInMsOrOneIfResultIsZero(maxIdle, maxIdleUnit));
        invokeOperation(keyData, operation);
    }
1121168
public function set($key, $value, $ttl = null)
    {
        $item = new Item($key, $value);
        if ($ttl !== null) {
            $item->expiresAfter($ttl);
        }
        return $this->save($item);
    }
223599
protected function ttlToMemcachedTime($ttl)
    {
        $seconds = $this->ttlToSeconds($ttl);

        if ($seconds <= 0) {
            return isset($seconds) ? false : 0;
        }

        /* 2592000 seconds = 30 days */
        return $seconds <= 2592000 ? $seconds : $this->ttlToTimestamp($ttl);
    }
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;
    }
29416
public void setTimeVal(long t) {
        int seconds = (int) (t / 1000);
        int millis = (int) (t - 1000 * t);
        this.timeVal = new TimeVal(seconds, millis * 1000, 0);
    }
1325866
public EpollSocketChannelConfig setTcpKeepIdle(int seconds) {
        try {
            ((EpollSocketChannel) channel).socket.setTcpKeepIdle(seconds);
            return this;
        } catch (IOException e) {
            throw new ChannelException(e);
        }
    }
415552
public String createToken(int ttl) {
        checkArgument(ttl > 0);

        CreateTokenRequest request = new CreateTokenRequest();
        request.setTtl(ttl);
        InternalRequest internalRequest = createRequest(request, HttpMethodName.POST, null, TOKEN);
        CreateTokenResponse response = this.invokeHttpClient(internalRequest, CreateTokenResponse.class);
        return response.getToken();
    }
622462
private function setTtl($ttl): float
    {
        $options = $this->cache->getOptions();
        $old_ttl = $options->getTtl();
        $options->setTtl($ttl === null ? $old_ttl : $ttl);
        $this->cache->setOptions($options);

        return $old_ttl;
    }
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;
    }
1274021
public void set(String key, String value, int ttl) throws EtcdClientException {
        set(key, value, ttl, null);
    }
502956
public function set($key, $value, $ttl, $time)
    {
        $this->data[$key] = array(
            self::CACHE_PARAM_VALUE => $value,
            self::CACHE_PARAM_CREATED => $time,
            self::CACHE_PARAM_TTL => $ttl
        );

        return $this;
    }
719020
public function setResult($key, $result, $ttl)
    {
        if (!($ttl instanceof Ttl)) {
            $ttl = new Ttl($ttl);
        }

        $expirationTimestamp = time() + $ttl->getTtl();
        $value = new Value($result, $expirationTimestamp);

        $this->valueStore->set($key, $value, $ttl->getRealTtl());
    }
587438
public function remember($key, $ttl, $callback)
    {
        $r = $this->get($key);
        if ($r === false) {
            $r = $callback();
            $this->set($key, $r, $ttl);
        }

        return $r;
    }
432046
public StoredChannel setExpiration(Long expiration) {
    lock.lock();
    try {
      this.expiration = expiration;
    } finally {
      lock.unlock();
    }
    return this;
  }