Versions in this module Expand all Collapse all v1 v1.1.0 Nov 6, 2026 v1.0.0 Nov 6, 2026 Changes in this version + const KeepTTL + var ErrLockBusy = errors.New("redis: lock busy") + var ErrNotFound = r.Nil + var ErrOwnership = errors.New("redis: lock ownership lost") + func Classify(e error) error + type Client struct + func New(ctx context.Context, c Config) (*Client, error) + func (c *Client) Acquire(ctx context.Context, key string, ttl time.Duration) (*Lock, error) + func (c *Client) CacheAside(ctx context.Context, key string, dst any, ttl time.Duration, ...) error + func (c *Client) Close() error + func (c *Client) ConsumeGroup(ctx context.Context, cfg StreamConsumerConfig, ...) error + func (c *Client) Decrement(ctx context.Context, key string) (int64, error) + func (c *Client) Delete(ctx context.Context, keys ...string) (int64, error) + func (c *Client) Eval(ctx context.Context, script string, keys []string, args ...any) (any, error) + func (c *Client) EvalSHA(ctx context.Context, sha string, keys []string, args ...any) (any, error) + func (c *Client) Exists(ctx context.Context, keys ...string) (int64, error) + func (c *Client) Expire(ctx context.Context, key string, ttl time.Duration) (bool, error) + func (c *Client) Get(ctx context.Context, key string) (string, error) + func (c *Client) GetAndDelete(ctx context.Context, key string) (string, error) + func (c *Client) GetBytes(ctx context.Context, key string) ([]byte, error) + func (c *Client) GetJSON(ctx context.Context, key string, dst any) error + func (c *Client) HDel(ctx context.Context, key string, fields ...string) (int64, error) + func (c *Client) HExists(ctx context.Context, key, field string) (bool, error) + func (c *Client) HGet(ctx context.Context, key, field string) (string, error) + func (c *Client) HGetAll(ctx context.Context, key string) (map[string]string, error) + func (c *Client) HIncrBy(ctx context.Context, key, field string, n int64) (int64, error) + func (c *Client) HSet(ctx context.Context, key string, values ...any) (int64, error) + func (c *Client) Increment(ctx context.Context, key string) (int64, error) + func (c *Client) IncrementBy(ctx context.Context, key string, n int64) (int64, error) + func (c *Client) LPop(ctx context.Context, key string) (string, error) + func (c *Client) LPush(ctx context.Context, key string, values ...any) (int64, error) + func (c *Client) LRange(ctx context.Context, key string, start, stop int64) ([]string, error) + func (c *Client) LTrim(ctx context.Context, key string, start, stop int64) error + func (c *Client) Native() r.UniversalClient + func (c *Client) Ping(ctx context.Context) error + func (c *Client) Pipeline(ctx context.Context, fn func(r.Pipeliner) error) error + func (c *Client) Publish(ctx context.Context, channel string, value any) (int64, error) + func (c *Client) RPop(ctx context.Context, key string) (string, error) + func (c *Client) RPush(ctx context.Context, key string, values ...any) (int64, error) + func (c *Client) RateLimit(ctx context.Context, key string, limit int64, window time.Duration) (allowed bool, remaining int64, retry time.Duration, err error) + func (c *Client) SAdd(ctx context.Context, key string, members ...any) (int64, error) + func (c *Client) SCard(ctx context.Context, key string) (int64, error) + func (c *Client) SIsMember(ctx context.Context, key string, member any) (bool, error) + func (c *Client) SMembers(ctx context.Context, key string) ([]string, error) + func (c *Client) SRem(ctx context.Context, key string, members ...any) (int64, error) + func (c *Client) ScriptLoad(ctx context.Context, script string) (string, error) + func (c *Client) Set(ctx context.Context, key string, value any, ttl time.Duration) error + func (c *Client) SetJSON(ctx context.Context, key string, value any, ttl time.Duration) error + func (c *Client) SetNX(ctx context.Context, key string, value any, ttl time.Duration) (bool, error) + func (c *Client) Stats() *PoolStats + func (c *Client) Subscribe(ctx context.Context, patterns bool, ...) error + func (c *Client) TTL(ctx context.Context, key string) (time.Duration, error) + func (c *Client) Transaction(ctx context.Context, fn func(r.Pipeliner) error) error + func (c *Client) Watch(ctx context.Context, fn func(*r.Tx) error, keys ...string) error + func (c *Client) XAck(ctx context.Context, key, group string, ids ...string) (int64, error) + func (c *Client) XAdd(ctx context.Context, key string, values map[string]any) (string, error) + func (c *Client) XAutoClaim(ctx context.Context, key, group, consumer, start string, idle time.Duration, ...) ([]StreamMessage, string, error) + func (c *Client) XClaim(ctx context.Context, key, group, consumer string, idle time.Duration, ...) ([]StreamMessage, error) + func (c *Client) XDelete(ctx context.Context, key string, ids ...string) (int64, error) + func (c *Client) XGroupCreate(ctx context.Context, key, group, start string) error + func (c *Client) XGroupDestroy(ctx context.Context, key, group string) (int64, error) + func (c *Client) XPending(ctx context.Context, key, group string) (*Pending, error) + func (c *Client) XRead(ctx context.Context, key, lastID string, count int64, block time.Duration) ([]Stream, error) + func (c *Client) XReadGroup(ctx context.Context, key, group, consumer, lastID string, count int64, ...) ([]Stream, error) + func (c *Client) ZAdd(ctx context.Context, key string, members ...ScoredMember) (int64, error) + func (c *Client) ZCard(ctx context.Context, key string) (int64, error) + func (c *Client) ZRange(ctx context.Context, key string, start, stop int64) ([]string, error) + func (c *Client) ZRangeByScore(ctx context.Context, key string, min, max string) ([]string, error) + func (c *Client) ZRem(ctx context.Context, key string, members ...any) (int64, error) + func (c *Client) ZScore(ctx context.Context, key, member string) (float64, error) + type Config struct + Addresses []string + AllowPlaintext bool + DB int + DialTimeout time.Duration + MasterName string + MaxRetries int + MinIdleConnections int + Mode Mode + Observer instrument.Hook + Password string + PoolSize int + Prefix string + ReadTimeout time.Duration + SentinelPassword string + SentinelUsername string + Serializer encodingx.Serializer + TLS *tls.Config + Username string + WriteTimeout time.Duration + type IdempotencyStore struct + Client *Client + func (s IdempotencyStore) Begin(ctx context.Context, key, fingerprint string, lease time.Duration) (idempotency.Record, error) + func (s IdempotencyStore) Complete(ctx context.Context, key, token string, status int, ttl time.Duration) error + func (s IdempotencyStore) Fail(ctx context.Context, key, token string, ttl time.Duration) error + func (s IdempotencyStore) Renew(ctx context.Context, key, token string, ttl time.Duration) error + type Limiter struct + Client *Client + Limit int64 + Window time.Duration + func (l Limiter) Allow(ctx context.Context, key string) (ratelimit.Decision, error) + type Lock struct + func (l *Lock) Owned(ctx context.Context) (bool, error) + func (l *Lock) Release(ctx context.Context) error + func (l *Lock) Renew(ctx context.Context, ttl time.Duration) error + type Message struct + Channel string + Pattern string + Payload string + type Mode string + const Cluster + const Sentinel + const Standalone + type Pending = r.XPending + type PoolStats = r.PoolStats + type ScoredMember = r.Z + type Stream = r.XStream + type StreamConsumerConfig struct + Block time.Duration + Consumer string + Count int64 + Group string + Stream string + type StreamMessage = r.XMessage