Sets the key to expire after ttl seconds
 @param [#to_f] ttl the time to live in seconds (where 0.001 = 1ms)
 @return [Boolean] true if expired, false otherwise
177050
def expire(ttl)
      ttl = (ttl.to_f * 1000).floor
      return coerce_bool(self.connection.pexpire(@key, ttl))
    end
631124
def set_idle_ttl(cls, pid, ttl):
        
        with cls._lock:
            cls._ensure_pool_exists(pid)
            cls._pools[pid].set_idle_ttl(ttl)
1361798
def ttl(self, key):
        
        key_value, key_age = self.get(key, with_age=True)
        if key_age:
            key_ttl = self.max_age - key_age
            if key_ttl > 0:
                return key_ttl
        return None
1047391
public function setExpire(int $seconds) : bool
        {
                return $this->_redis->expire($this->_key, $seconds) > 0 ? true : false;
        }
561157
private boolean isExpired(CacheEntry entry) {
        if (ttl == 0) {
            return false;
        }

        return entry.getTimestamp() + ttl < System.currentTimeMillis();
    }
47835
def check_ttl_max_tries(tries, enqueued_at, max_tries, ttl):
    ''''''
    if max_tries > 0 and tries >= max_tries:
        raise FSQMaxTriesError(errno.EINTR, u'Max tries exceded:'\
                               u' {0} ({1})'.format(max_tries, tries))
    if ttl > 0 and datetime.datetime.now() < enqueued_at + datetime.timedelta(
            seconds=ttl):
        raise FSQTTLExpiredError(errno.EINTR, u'TTL Expired:'\
                                 u' {0}'.format(ttl))
67253
def is_expired(self):
        
        expires_at = self.expires_at
        if expires_at is not None and expires_at != self.created:
            return expires_at < datetime.utcnow()

        return False
1350593
def expires_in(self):
        
        time_left = self.expires_at - int(time.time())

        if time_left > 0:
            return time_left
        return 0
662608
def set(self, time_sec, callback_fn, *args, **kwdargs):
        
        timer = self.timer()
        timer.set_callback('expired', callback_fn, *args, **kwdargs)
        timer.set(time_sec)
        return timer
108634
def EXPIRING_TOKEN_LIFESPAN(self):
        
        try:
            val = settings.EXPIRING_TOKEN_LIFESPAN
        except AttributeError:
            val = timedelta(days=30)

        return val
1178429
public function set($key, $value, $ttl = 0) {
        if (is_resource($value)) {
            return false;
        }
        $used_key = $this->getUsedKey($key);
        $res = $this->redis->set($used_key, $this->esc($value));

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

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

        return ($this->redis->expire($used_key, $ttl) == 1);
    }
312368
def set(key, opts = nil)
      fail ArgumentError, 'Second argument must be a hash' unless opts.is_a?(Hash)
      path  = key_endpoint + key
      payload = {}
      [:ttl, :value, :dir, :prevExist, :prevValue, :prevIndex].each do |k|
        payload[k] = opts[k] if opts.key?(k)
      end
      response = api_execute(path, :put, params: payload)
      Response.from_http_response(response)
    end
341082
def set(key, value, expires: nil)
      validate_key(key)
      validate_value(value)

      mset({ key => value }, expires: expires)
    end
72003
def update(self, ttl=values.unset):
        
        return self._proxy.update(ttl=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);
    }
822204
function setKey(key, val, flag, expiry, xflag, req) {
  var exists = this._data[key] !== undefined;
  var o = {v: val, t: Date.now()};
  if((xflag === Constants.NX && exists)
    || (xflag === Constants.XX && !exists)) {
    return undefined;
  }
  this._data[key] = o;
  if(!exists) {
    this._keys.push(key);
  }
  if((flag === Constants.EX || flag === Constants.PX)
    && expiry !== undefined) {
    expiry = flag === Constants.EX
      ? Date.now() + (expiry * 1000)
      : Date.now() + expiry;
    this.setExpiry(key, expiry, req);
  }
  return Constants.OK;
}
403670
final public function expire($key, $ttl) {
		$method = 'setTimeout';
		if ($this->redistype == 'predis')
			$method = 'expire';
		$res = $this->connection->$method($key, $ttl);
		self::$logger->info(sprintf(
			"Redis: expire %s: %s.", $key, $ttl));
		return $res;
	}