// HExpireAt expires the data at time when.
434659
func (db *DB) HExpireAt(key []byte, when int64) (int64, error) {
	if when <= time.Now().Unix() {
		return 0, errExpireValue
	}

	return db.hExpireAt(key, when)
}
1031595
func (t *token) Expired() bool {
	if t == nil {
		return true
	}
	return !t.Token.Valid()
}
943690
func HexData(b []uint8) string {
	td := b[:]
	m := senv.MaxBodyLength()
	if m > 0 {
		if m < len(td) {
			td = td[:m]
		}
	}
	return "\n" + hex.Dump(td)
}
884475
func (i *Item) SetExpire(ttl int64) {
	if ttl == 0 {
		return
	}
	i.ExpiredAt = i.CreatedAt + ttl*int64(time.Millisecond)
}
612045
func (eh *ExpiresHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
	hrw := &headerResponseWriter{
		ResponseWriter: rw,
		OnWriteHeaderFunc: func(code int) {
			if code == http.StatusOK || code == http.StatusNotModified {
				t := time.Now()
				t = t.Add(eh.Expires)
				t = t.In(expiresHeaderLocation)
				rw.Header().Set("Expires", t.Format(time.RFC1123))
			}
		},
	}
	eh.Handler.ServeHTTP(hrw, req)
}
1321408
func (r *SeededRNG) HexDigest(bytes int) (string, error) {
	return hexDigest(r, bytes)
}
330374
func (d *AuthorizeData) ExpireAt() time.Time {
	return d.CreatedAt.Add(time.Duration(d.ExpiresIn) * time.Second)
}
709160
func (s *streamImpl) expireTime() (t time.Time, has bool) {
	s.withParserLock(func() error {
		t, has = s.c.parser.firstChunkTime()
		return nil
	})

	if has {
		t = t.Add(s.c.maximumBufferDuration)
	}
	return
}
696765
func Hex2Uint(str string) (uint64, error) {
	if len(str) > 2 {
		if head := str[:2]; head == "0x" || head == "0X" {
			str = str[2:]
		}
	}

	var n uint64
	for _, c := range str {
		if c >= '0' && c <= '9' {
			c = c - '0'
		} else if c >= 'a' && c <= 'f' {
			c = c - 'a' + 10
		} else if c >= 'A' && c <= 'F' {
			c = c - 'A' + 10
		} else {
			return 0, errors.Newf("Invalid hexadecimal string %s", str)
		}
		n = n << 4
		n |= uint64(c)
	}

	return n, nil
}
1303971
func (c *Client) Expire(key string, seconds int) (bool, error) {
	v, err := c.execWithKey(true, "EXPIRE", key, seconds)
	if err != nil {
		return false, err
	}
	return iface2bool(v)
}
946770
func (t *Token) Expired() bool {
	return t.ClaimSet.exp.Before(time.Now())
}
848010
func (db *DB) ExpireAt(key []byte, when int64) (int64, error) {
	if when <= time.Now().Unix() {
		return 0, errExpireValue
	}

	return db.setExpireAt(key, when)
}
419186
func (a *Account) AutoExpireTTL() time.Duration {
	a.mu.RLock()
	defer a.mu.RUnlock()
	return a.maxaettl
}
1086049
func (rb *reorderBuffer) bytesAt(n int) []byte {
	inf := rb.rune[n]
	return rb.byte[inf.pos : int(inf.pos)+int(inf.size)]
}
955676
func (tv *TimedValue) StatusAt(when time.Time) TimedValueStatus {
	if tv.IsExpiredAt(when) {
		return Expired
	}
	if tv.IsStaleAt(when) {
		return Stale
	}
	return Fresh
}
680319
func (s *SeqSet) insertAt(i int, v Seq) {
	if n := len(s.Set); i == n {
		// insert at the end
		s.Set = append(s.Set, v)
		return
	} else if n < cap(s.Set) {
		// enough space, shift everything at and after i to the right
		s.Set = s.Set[:n+1]
		copy(s.Set[i+1:], s.Set[i:])
	} else {
		// allocate new slice and copy everything, n is at least 1
		set := make([]Seq, n+1, n*2)
		copy(set, s.Set[:i])
		copy(set[i+1:], s.Set[i:])
		s.Set = set
	}
	s.Set[i] = v
}
293194
func (db *DB) ZExpireAt(key []byte, when int64) (int64, error) {
	if when <= time.Now().Unix() {
		return 0, errExpireValue
	}

	return db.zExpireAt(key, when)
}