redis

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireLock

func AcquireLock(ctx context.Context, key string, value interface{}, expiration time.Duration) (bool, error)

func BGSave

func BGSave(ctx context.Context) error

func Close added in v0.3.0

func Close() error

Close closes the active Redis client and releases all connections. Safe to call even if Redis was never set up (no-op when not enabled).

func Delete

func Delete(ctx context.Context, key string) error

func ExtendLock

func ExtendLock(ctx context.Context, key string, expiration time.Duration) error

func Get

func Get(ctx context.Context, key string) (string, error)

func GetRedis

func GetRedis() *redis.Client

func GetRedisCluster added in v0.1.9

func GetRedisCluster() *redis.ClusterClient

func GetUniversalClient added in v0.1.9

func GetUniversalClient() redis.Cmdable

GetUniversalClient returns a universal client interface that works with both standard and cluster clients.

func HGet

func HGet(ctx context.Context, key, field string) (string, error)

func HGetAll

func HGetAll(ctx context.Context, key string) (map[string]string, error)

func HSet

func HSet(ctx context.Context, key string, field string, value interface{}) error

func HSetMap

func HSetMap(ctx context.Context, key string, fields map[string]interface{}) error

func IsAlive

func IsAlive() bool

func LPush

func LPush(ctx context.Context, key string, values ...interface{}) error

func LRange

func LRange(ctx context.Context, key string, start, stop int64) ([]string, error)

func MGet

func MGet(ctx context.Context, keys ...string) ([]string, error)

func MSet

func MSet(ctx context.Context, pairs map[string]interface{}) error

func Pipeline

func Pipeline(ctx context.Context, f func(pipe redis.Pipeliner)) error

func PipelineSet

func PipelineSet(ctx context.Context, keyValues map[string]interface{}, expiration time.Duration) error

func PublishMessage

func PublishMessage(ctx context.Context, channel, message string) error

func RPop

func RPop(ctx context.Context, key string) (string, error)

func ReleaseLock

func ReleaseLock(ctx context.Context, key string) error

func SAdd

func SAdd(ctx context.Context, key string, members ...interface{}) error

func SMembers

func SMembers(ctx context.Context, key string) ([]string, error)

func SRem

func SRem(ctx context.Context, key string, members ...interface{}) error

func Save

func Save(ctx context.Context) error

func ScanKeys

func ScanKeys(ctx context.Context, pattern string, count int64) ([]string, error)

func Set

func Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error

func Setup

func Setup() error

func SubscribeToChannel

func SubscribeToChannel(ctx context.Context, channel string, handler func(message string)) error

SubscribeToChannel subscribes to a channel and calls handler for each message until ctx is cancelled.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL