Versions in this module Expand all Collapse all v2 v2.2.0 Oct 28, 2026 v2.1.0 Oct 22, 2026 Changes in this version + var ErrScoreNaN = errors.New("ERR resulting score is not a number (NaN)") + var ErrZAddIncrPair = errors.New("ERR INCR option supports a single increment-element pair") type BoltCache + func (c *BoltCache) ShardOf(key string) int type Kind + const KindZSet + type ScoreBound struct + Exclusive bool + Value float64 type Tx + func (t *Tx) ZAdd(key string, opts ZAddOptions, members []ZMember) (ZAddResult, error) + func (t *Tx) ZCard(key string) (int, error) + func (t *Tx) ZCount(key string, min, max ScoreBound) (int, error) + func (t *Tx) ZMScore(key string, members ...string) ([]float64, []bool, error) + func (t *Tx) ZMembers(key string) ([]ZMember, error) + func (t *Tx) ZPop(key string, count int, max bool) ([]ZMember, error) + func (t *Tx) ZRangeByRank(key string, start, stop int, rev bool) ([]ZMember, error) + func (t *Tx) ZRangeByScore(key string, min, max ScoreBound, rev bool, offset, count int) ([]ZMember, error) + func (t *Tx) ZRank(key, member string, rev bool) (rank int, score float64, ok bool, err error) + func (t *Tx) ZRem(key string, members ...string) (int, error) + func (t *Tx) ZRemRangeByRank(key string, start, stop int) (int, error) + func (t *Tx) ZRemRangeByScore(key string, min, max ScoreBound) (int, error) + func (t *Tx) ZScore(key, member string) (float64, bool, error) + type ZAddOptions struct + GT bool + Incr bool + LT bool + NX bool + XX bool + type ZAddResult struct + Added int + Applied bool + Changed int + Score float64 + type ZMember struct + Member string + Score float64 v2.0.1 Oct 22, 2026 Changes in this version + const TTLNoExpire + const TTLNoKey + var ErrIndexRange = errors.New("ERR index out of range") + var ErrNoSuchKey = errors.New("ERR no such key") + var ErrNotFloat = errors.New("ERR value is not a valid float") + var ErrNotInAtomicCtx = errors.New("ERR this command is not allowed inside scripts") + var ErrNotInteger = errors.New("ERR value is not an integer or out of range") + var ErrOOM = errors.New("OOM command not allowed when used memory > 'maxmemory'") + var ErrOverflow = errors.New("ERR increment or decrement would overflow") + var ErrUndeclaredKey = errors.New("ERR script tried accessing a key that was not declared in KEYS") + var ErrWrongType = errors.New("WRONGTYPE Operation against a key holding the wrong kind of value") + func UnixNano(t time.Time) int64 + type BoltCache struct + func New(opts Options) *BoltCache + func (c *BoltCache) Atomic(keys []string, all bool, fn func(tx *Tx) error) (err error) + func (c *BoltCache) Close() + func (c *BoltCache) DeleteExpired() int + func (c *BoltCache) KeyVersion(key string) uint64 + func (c *BoltCache) Len() int64 + func (c *BoltCache) Load(r io.Reader) (int, error) + func (c *BoltCache) LoadFile(path string) (int, error) + func (c *BoltCache) OOM() bool + func (c *BoltCache) Options() Options + func (c *BoltCache) SaveFile(path string, compress bool) (int, error) + func (c *BoltCache) Snapshot(w io.Writer) (int, error) + func (c *BoltCache) Stats() Stats + func (c *BoltCache) UsedMemory() int64 + func (c *BoltCache) Writes() uint64 + type ExpireCond uint8 + const ExpireAlways + const ExpireGT + const ExpireLT + const ExpireNX + const ExpireXX + type Kind uint8 + const KindHash + const KindList + const KindNone + const KindSet + const KindString + func (k Kind) String() string + type Options struct + CleanupInterval time.Duration + EvictionPolicy Policy + EvictionThreshold float64 + MaxKeys int64 + MaxMemory int64 + type PersistOptions struct + BackupCount int + CleanupWhenExceeds int + Compress bool + File string + Interval time.Duration + Logf func(format string, args ...any) + type Persister struct + func NewPersister(c *BoltCache, opts PersistOptions) *Persister + func (p *Persister) LastSave() time.Time + func (p *Persister) Load() (int, error) + func (p *Persister) Save(force bool) (bool, error) + func (p *Persister) Start() + func (p *Persister) Stop() error + type Policy string + const PolicyLFU + const PolicyLRU + const PolicyNoEviction + const PolicyRandom + const PolicyTTL + func ParsePolicy(s string) (Policy, error) + type SetOptions struct + ExpireAt time.Time + KeepTTL bool + NX bool + TTL time.Duration + XX bool + type SetResult struct + HadOld bool + Old string + Written bool + type Stats struct + Evicted uint64 + Expired uint64 + Hits uint64 + Keys int64 + KeysWithTTL int64 + Misses uint64 + UsedMemory int64 + Writes uint64 + type Tx struct + func (t *Tx) Append(key, val string) (int, error) + func (t *Tx) DBSize() (int64, error) + func (t *Tx) Del(keys ...string) (int, error) + func (t *Tx) Delete(key string) (bool, error) + func (t *Tx) Exists(keys ...string) (int, error) + func (t *Tx) Expire(key string, d time.Duration, cond ExpireCond) (bool, error) + func (t *Tx) ExpireAt(key string, at time.Time, cond ExpireCond) (bool, error) + func (t *Tx) ExpireTime(key string) (at time.Time, state int, err error) + func (t *Tx) FlushAll() error + func (t *Tx) Get(key string) (string, bool, error) + func (t *Tx) GetDel(key string) (string, bool, error) + func (t *Tx) GetEx(key string, exp int64, persist bool) (string, bool, error) + func (t *Tx) GetRange(key string, start, end int) (string, error) + func (t *Tx) HDel(key string, fields ...string) (int, error) + func (t *Tx) HExists(key, field string) (bool, error) + func (t *Tx) HGet(key, field string) (string, bool, error) + func (t *Tx) HGetAll(key string) ([]string, error) + func (t *Tx) HIncrBy(key, field string, delta int64) (int64, error) + func (t *Tx) HIncrByFloat(key, field string, delta float64) (float64, error) + func (t *Tx) HKeys(key string) ([]string, error) + func (t *Tx) HLen(key string) (int, error) + func (t *Tx) HMGet(key string, fields ...string) ([]string, []bool, error) + func (t *Tx) HSet(key string, pairs ...string) (int, error) + func (t *Tx) HSetNX(key, field, val string) (bool, error) + func (t *Tx) HStrLen(key, field string) (int, error) + func (t *Tx) HVals(key string) ([]string, error) + func (t *Tx) InAtomic() bool + func (t *Tx) IncrBy(key string, delta int64) (int64, error) + func (t *Tx) IncrByFloat(key string, delta float64) (float64, error) + func (t *Tx) Keys(pattern string) ([]string, error) + func (t *Tx) LIndex(key string, index int) (string, bool, error) + func (t *Tx) LLen(key string) (int, error) + func (t *Tx) LPop(key string, count int) ([]string, error) + func (t *Tx) LPush(key string, vals ...string) (int, error) + func (t *Tx) LPushX(key string, vals ...string) (int, error) + func (t *Tx) LRange(key string, start, stop int) ([]string, error) + func (t *Tx) LRem(key string, count int, val string) (int, error) + func (t *Tx) LSet(key string, index int, val string) error + func (t *Tx) LTrim(key string, start, stop int) error + func (t *Tx) MGet(keys ...string) ([]string, []bool, error) + func (t *Tx) MemoryUsage(key string) (int64, error) + func (t *Tx) Persist(key string) (bool, error) + func (t *Tx) RPop(key string, count int) ([]string, error) + func (t *Tx) RPush(key string, vals ...string) (int, error) + func (t *Tx) RPushX(key string, vals ...string) (int, error) + func (t *Tx) RandomKey() (string, bool, error) + func (t *Tx) Rename(src, dst string, nx bool) (bool, error) + func (t *Tx) SAdd(key string, members ...string) (int, error) + func (t *Tx) SCard(key string) (int, error) + func (t *Tx) SDiff(keys ...string) ([]string, error) + func (t *Tx) SInter(keys ...string) ([]string, error) + func (t *Tx) SIsMember(key, member string) (bool, error) + func (t *Tx) SMIsMember(key string, members ...string) ([]bool, error) + func (t *Tx) SMembers(key string) ([]string, error) + func (t *Tx) SPop(key string, count int) ([]string, error) + func (t *Tx) SRem(key string, members ...string) (int, error) + func (t *Tx) SUnion(keys ...string) ([]string, error) + func (t *Tx) Scan(cursor uint64, pattern string, count int, kind Kind) (next uint64, keys []string, err error) + func (t *Tx) Set(key, val string, ttl time.Duration) error + func (t *Tx) SetWithOptions(key, val string, opts SetOptions, wantOld bool) (SetResult, error) + func (t *Tx) StrLen(key string) (int, error) + func (t *Tx) TTL(key string) (d time.Duration, state int, err error) + func (t *Tx) Type(key string) (Kind, error)