Versions in this module Expand all Collapse all v1 v1.3.3 Apr 18, 2022 Changes in this version type Redis + func (s *Redis) BitCountCtx(ctx context.Context, key string, start, end int64) (val int64, err error) + func (s *Redis) BitOpAndCtx(ctx context.Context, destKey string, keys ...string) (val int64, err error) + func (s *Redis) BitOpNotCtx(ctx context.Context, destKey, key string) (val int64, err error) + func (s *Redis) BitOpOrCtx(ctx context.Context, destKey string, keys ...string) (val int64, err error) + func (s *Redis) BitOpXorCtx(ctx context.Context, destKey string, keys ...string) (val int64, err error) + func (s *Redis) BitPosCtx(ctx context.Context, key string, bit, start, end int64) (val int64, err error) + func (s *Redis) BlpopCtx(ctx context.Context, node RedisNode, key string) (string, error) + func (s *Redis) BlpopExCtx(ctx context.Context, node RedisNode, key string) (string, bool, error) + func (s *Redis) DecrCtx(ctx context.Context, key string) (val int64, err error) + func (s *Redis) DecrbyCtx(ctx context.Context, key string, decrement int64) (val int64, err error) + func (s *Redis) DelCtx(ctx context.Context, keys ...string) (val int, err error) + func (s *Redis) EvalCtx(ctx context.Context, script string, keys []string, args ...interface{}) (val interface{}, err error) + func (s *Redis) EvalShaCtx(ctx context.Context, sha string, keys []string, args ...interface{}) (val interface{}, err error) + func (s *Redis) ExistsCtx(ctx context.Context, key string) (val bool, err error) + func (s *Redis) ExpireCtx(ctx context.Context, key string, seconds int) error + func (s *Redis) ExpireatCtx(ctx context.Context, key string, expireTime int64) error + func (s *Redis) GeoAddCtx(ctx context.Context, key string, geoLocation ...*GeoLocation) (val int64, err error) + func (s *Redis) GeoDistCtx(ctx context.Context, key, member1, member2, unit string) (val float64, err error) + func (s *Redis) GeoHashCtx(ctx context.Context, key string, members ...string) (val []string, err error) + func (s *Redis) GeoPosCtx(ctx context.Context, key string, members ...string) (val []*GeoPos, err error) + func (s *Redis) GeoRadiusByMemberCtx(ctx context.Context, key, member string, query *GeoRadiusQuery) (val []GeoLocation, err error) + func (s *Redis) GeoRadiusCtx(ctx context.Context, key string, longitude, latitude float64, ...) (val []GeoLocation, err error) + func (s *Redis) GetBitCtx(ctx context.Context, key string, offset int64) (val int, err error) + func (s *Redis) GetCtx(ctx context.Context, key string) (val string, err error) + func (s *Redis) GetSet(key, value string) (string, error) + func (s *Redis) GetSetCtx(ctx context.Context, key, value string) (val string, err error) + func (s *Redis) HdelCtx(ctx context.Context, key string, fields ...string) (val bool, err error) + func (s *Redis) HexistsCtx(ctx context.Context, key, field string) (val bool, err error) + func (s *Redis) HgetCtx(ctx context.Context, key, field string) (val string, err error) + func (s *Redis) HgetallCtx(ctx context.Context, key string) (val map[string]string, err error) + func (s *Redis) HincrbyCtx(ctx context.Context, key, field string, increment int) (val int, err error) + func (s *Redis) HkeysCtx(ctx context.Context, key string) (val []string, err error) + func (s *Redis) HlenCtx(ctx context.Context, key string) (val int, err error) + func (s *Redis) HmgetCtx(ctx context.Context, key string, fields ...string) (val []string, err error) + func (s *Redis) HmsetCtx(ctx context.Context, key string, fieldsAndValues map[string]string) error + func (s *Redis) HscanCtx(ctx context.Context, key string, cursor uint64, match string, count int64) (keys []string, cur uint64, err error) + func (s *Redis) HsetCtx(ctx context.Context, key, field, value string) error + func (s *Redis) HsetnxCtx(ctx context.Context, key, field, value string) (val bool, err error) + func (s *Redis) HvalsCtx(ctx context.Context, key string) (val []string, err error) + func (s *Redis) IncrCtx(ctx context.Context, key string) (val int64, err error) + func (s *Redis) IncrbyCtx(ctx context.Context, key string, increment int64) (val int64, err error) + func (s *Redis) KeysCtx(ctx context.Context, pattern string) (val []string, err error) + func (s *Redis) LindexCtx(ctx context.Context, key string, index int64) (val string, err error) + func (s *Redis) LlenCtx(ctx context.Context, key string) (val int, err error) + func (s *Redis) LpopCtx(ctx context.Context, key string) (val string, err error) + func (s *Redis) LpushCtx(ctx context.Context, key string, values ...interface{}) (val int, err error) + func (s *Redis) LrangeCtx(ctx context.Context, key string, start, stop int) (val []string, err error) + func (s *Redis) LremCtx(ctx context.Context, key string, count int, value string) (val int, err error) + func (s *Redis) LtrimCtx(ctx context.Context, key string, start, stop int64) error + func (s *Redis) MgetCtx(ctx context.Context, keys ...string) (val []string, err error) + func (s *Redis) PersistCtx(ctx context.Context, key string) (val bool, err error) + func (s *Redis) PfaddCtx(ctx context.Context, key string, values ...interface{}) (val bool, err error) + func (s *Redis) PfcountCtx(ctx context.Context, key string) (val int64, err error) + func (s *Redis) PfmergeCtx(ctx context.Context, dest string, keys ...string) error + func (s *Redis) PingCtx(ctx context.Context) (val bool) + func (s *Redis) PipelinedCtx(ctx context.Context, fn func(Pipeliner) error) (err error) + func (s *Redis) RpopCtx(ctx context.Context, key string) (val string, err error) + func (s *Redis) RpushCtx(ctx context.Context, key string, values ...interface{}) (val int, err error) + func (s *Redis) SaddCtx(ctx context.Context, key string, values ...interface{}) (val int, err error) + func (s *Redis) ScanCtx(ctx context.Context, cursor uint64, match string, count int64) (keys []string, cur uint64, err error) + func (s *Redis) ScardCtx(ctx context.Context, key string) (val int64, err error) + func (s *Redis) ScriptLoadCtx(ctx context.Context, script string) (string, error) + func (s *Redis) SdiffCtx(ctx context.Context, keys ...string) (val []string, err error) + func (s *Redis) SdiffstoreCtx(ctx context.Context, destination string, keys ...string) (val int, err error) + func (s *Redis) SetBitCtx(ctx context.Context, key string, offset int64, value int) (val int, err error) + func (s *Redis) SetCtx(ctx context.Context, key, value string) error + func (s *Redis) SetexCtx(ctx context.Context, key, value string, seconds int) error + func (s *Redis) SetnxCtx(ctx context.Context, key, value string) (val bool, err error) + func (s *Redis) SetnxExCtx(ctx context.Context, key, value string, seconds int) (val bool, err error) + func (s *Redis) SinterCtx(ctx context.Context, keys ...string) (val []string, err error) + func (s *Redis) SinterstoreCtx(ctx context.Context, destination string, keys ...string) (val int, err error) + func (s *Redis) SismemberCtx(ctx context.Context, key string, value interface{}) (val bool, err error) + func (s *Redis) SmembersCtx(ctx context.Context, key string) (val []string, err error) + func (s *Redis) SpopCtx(ctx context.Context, key string) (val string, err error) + func (s *Redis) SrandmemberCtx(ctx context.Context, key string, count int) (val []string, err error) + func (s *Redis) SremCtx(ctx context.Context, key string, values ...interface{}) (val int, err error) + func (s *Redis) SscanCtx(ctx context.Context, key string, cursor uint64, match string, count int64) (keys []string, cur uint64, err error) + func (s *Redis) SunionCtx(ctx context.Context, keys ...string) (val []string, err error) + func (s *Redis) SunionstoreCtx(ctx context.Context, destination string, keys ...string) (val int, err error) + func (s *Redis) TtlCtx(ctx context.Context, key string) (val int, err error) + func (s *Redis) ZRevRangeWithScoresCtx(ctx context.Context, key string, start, stop int64) (val []Pair, err error) + func (s *Redis) ZaddCtx(ctx context.Context, key string, score int64, value string) (val bool, err error) + func (s *Redis) ZaddsCtx(ctx context.Context, key string, ps ...Pair) (val int64, err error) + func (s *Redis) ZcardCtx(ctx context.Context, key string) (val int, err error) + func (s *Redis) ZcountCtx(ctx context.Context, key string, start, stop int64) (val int, err error) + func (s *Redis) ZincrbyCtx(ctx context.Context, key string, increment int64, field string) (val int64, err error) + func (s *Redis) ZrangeCtx(ctx context.Context, key string, start, stop int64) (val []string, err error) + func (s *Redis) ZrangeWithScoresCtx(ctx context.Context, key string, start, stop int64) (val []Pair, err error) + func (s *Redis) ZrangebyscoreWithScoresAndLimitCtx(ctx context.Context, key string, start, stop int64, page, size int) (val []Pair, err error) + func (s *Redis) ZrangebyscoreWithScoresCtx(ctx context.Context, key string, start, stop int64) (val []Pair, err error) + func (s *Redis) ZrankCtx(ctx context.Context, key, field string) (val int64, err error) + func (s *Redis) ZremCtx(ctx context.Context, key string, values ...interface{}) (val int, err error) + func (s *Redis) ZremrangebyrankCtx(ctx context.Context, key string, start, stop int64) (val int, err error) + func (s *Redis) ZremrangebyscoreCtx(ctx context.Context, key string, start, stop int64) (val int, err error) + func (s *Redis) ZrevrangeCtx(ctx context.Context, key string, start, stop int64) (val []string, err error) + func (s *Redis) ZrevrangebyscoreWithScoresAndLimitCtx(ctx context.Context, key string, start, stop int64, page, size int) (val []Pair, err error) + func (s *Redis) ZrevrangebyscoreWithScoresCtx(ctx context.Context, key string, start, stop int64) (val []Pair, err error) + func (s *Redis) ZrevrankCtx(ctx context.Context, key, field string) (val int64, err error) + func (s *Redis) ZscoreCtx(ctx context.Context, key, value string) (val int64, err error) + func (s *Redis) ZunionstoreCtx(ctx context.Context, dest string, store *ZStore) (val int64, err error) v1.2.9 Feb 23, 2022 Changes in this version type Option + func WithDB(db int) Option v1.2.8 Feb 23, 2022 Changes in this version type Redis + DB int v1.2.7 Jan 20, 2022 Changes in this version + const ClusterType + const Nil + const NodeType + var ErrEmptyHost = errors.New("empty redis host") + var ErrEmptyKey = errors.New("empty redis key") + var ErrEmptyType = errors.New("empty redis type") + var ErrNilNode = errors.New("nil redis node") + func SetSlowThreshold(threshold time.Duration) + type ClosableNode interface + Close func() + func CreateBlockingNode(r *Redis) (ClosableNode, error) + type FloatCmd = red.FloatCmd + type GeoLocation = red.GeoLocation + type GeoPos = red.GeoPos + type GeoRadiusQuery = red.GeoRadiusQuery + type IntCmd = red.IntCmd + type Map map[string]string + type Option func(r *Redis) + func Cluster() Option + func WithPass(pass string) Option + func WithPoolSize(poolSize int) Option + func WithPoolTimeout(poolTimeout time.Duration) Option + func WithTLS() Option + type Pair struct + Key string + Score int64 + type Pipeliner = red.Pipeliner + type Redis struct + Addr string + Pass string + PoolSize int + PoolTimeout time.Duration + Type string + func New(addr string, opts ...Option) *Redis + func NewRedis(redisAddr, redisType string, redisPass ...string) *Redis + func (s *Redis) BitCount(key string, start, end int64) (val int64, err error) + func (s *Redis) BitOpAnd(destKey string, keys ...string) (val int64, err error) + func (s *Redis) BitOpNot(destKey, key string) (val int64, err error) + func (s *Redis) BitOpOr(destKey string, keys ...string) (val int64, err error) + func (s *Redis) BitOpXor(destKey string, keys ...string) (val int64, err error) + func (s *Redis) BitPos(key string, bit, start, end int64) (val int64, err error) + func (s *Redis) Blpop(redisNode RedisNode, key string) (string, error) + func (s *Redis) BlpopEx(redisNode RedisNode, key string) (string, bool, error) + func (s *Redis) Decr(key string) (val int64, err error) + func (s *Redis) Decrby(key string, increment int64) (val int64, err error) + func (s *Redis) Del(keys ...string) (val int, err error) + func (s *Redis) Eval(script string, keys []string, args ...interface{}) (val interface{}, err error) + func (s *Redis) EvalSha(sha string, keys []string, args ...interface{}) (val interface{}, err error) + func (s *Redis) Exists(key string) (val bool, err error) + func (s *Redis) Expire(key string, seconds int) error + func (s *Redis) Expireat(key string, expireTime int64) error + func (s *Redis) GeoAdd(key string, geoLocation ...*GeoLocation) (val int64, err error) + func (s *Redis) GeoDist(key, member1, member2, unit string) (val float64, err error) + func (s *Redis) GeoHash(key string, members ...string) (val []string, err error) + func (s *Redis) GeoPos(key string, members ...string) (val []*GeoPos, err error) + func (s *Redis) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) (val []GeoLocation, err error) + func (s *Redis) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) (val []GeoLocation, err error) + func (s *Redis) Get(key string) (val string, err error) + func (s *Redis) GetBit(key string, offset int64) (val int, err error) + func (s *Redis) Hdel(key string, fields ...string) (val bool, err error) + func (s *Redis) Hexists(key, field string) (val bool, err error) + func (s *Redis) Hget(key, field string) (val string, err error) + func (s *Redis) Hgetall(key string) (val map[string]string, err error) + func (s *Redis) Hincrby(key, field string, increment int) (val int, err error) + func (s *Redis) Hkeys(key string) (val []string, err error) + func (s *Redis) Hlen(key string) (val int, err error) + func (s *Redis) Hmget(key string, fields ...string) (val []string, err error) + func (s *Redis) Hmset(key string, fieldsAndValues map[string]string) error + func (s *Redis) Hscan(key string, cursor uint64, match string, count int64) (keys []string, cur uint64, err error) + func (s *Redis) Hset(key, field, value string) error + func (s *Redis) Hsetnx(key, field, value string) (val bool, err error) + func (s *Redis) Hvals(key string) (val []string, err error) + func (s *Redis) Incr(key string) (val int64, err error) + func (s *Redis) Incrby(key string, increment int64) (val int64, err error) + func (s *Redis) Keys(pattern string) (val []string, err error) + func (s *Redis) Lindex(key string, index int64) (val string, err error) + func (s *Redis) Llen(key string) (val int, err error) + func (s *Redis) Lpop(key string) (val string, err error) + func (s *Redis) Lpush(key string, values ...interface{}) (val int, err error) + func (s *Redis) Lrange(key string, start, stop int) (val []string, err error) + func (s *Redis) Lrem(key string, count int, value string) (val int, err error) + func (s *Redis) Ltrim(key string, start, stop int64) error + func (s *Redis) Mget(keys ...string) (val []string, err error) + func (s *Redis) Persist(key string) (val bool, err error) + func (s *Redis) Pfadd(key string, values ...interface{}) (val bool, err error) + func (s *Redis) Pfcount(key string) (val int64, err error) + func (s *Redis) Pfmerge(dest string, keys ...string) error + func (s *Redis) Ping() (val bool) + func (s *Redis) Pipelined(fn func(Pipeliner) error) (err error) + func (s *Redis) Rpop(key string) (val string, err error) + func (s *Redis) Rpush(key string, values ...interface{}) (val int, err error) + func (s *Redis) Sadd(key string, values ...interface{}) (val int, err error) + func (s *Redis) Scan(cursor uint64, match string, count int64) (keys []string, cur uint64, err error) + func (s *Redis) Scard(key string) (val int64, err error) + func (s *Redis) ScriptLoad(script string) (string, error) + func (s *Redis) Sdiff(keys ...string) (val []string, err error) + func (s *Redis) Sdiffstore(destination string, keys ...string) (val int, err error) + func (s *Redis) Set(key, value string) error + func (s *Redis) SetBit(key string, offset int64, value int) error + func (s *Redis) Setex(key, value string, seconds int) error + func (s *Redis) Setnx(key, value string) (val bool, err error) + func (s *Redis) SetnxEx(key, value string, seconds int) (val bool, err error) + func (s *Redis) Sinter(keys ...string) (val []string, err error) + func (s *Redis) Sinterstore(destination string, keys ...string) (val int, err error) + func (s *Redis) Sismember(key string, value interface{}) (val bool, err error) + func (s *Redis) Smembers(key string) (val []string, err error) + func (s *Redis) Spop(key string) (val string, err error) + func (s *Redis) Srandmember(key string, count int) (val []string, err error) + func (s *Redis) Srem(key string, values ...interface{}) (val int, err error) + func (s *Redis) Sscan(key string, cursor uint64, match string, count int64) (keys []string, cur uint64, err error) + func (s *Redis) String() string + func (s *Redis) Sunion(keys ...string) (val []string, err error) + func (s *Redis) Sunionstore(destination string, keys ...string) (val int, err error) + func (s *Redis) Ttl(key string) (val int, err error) + func (s *Redis) ZRevRangeWithScores(key string, start, stop int64) (val []Pair, err error) + func (s *Redis) Zadd(key string, score int64, value string) (val bool, err error) + func (s *Redis) Zadds(key string, ps ...Pair) (val int64, err error) + func (s *Redis) Zcard(key string) (val int, err error) + func (s *Redis) Zcount(key string, start, stop int64) (val int, err error) + func (s *Redis) Zincrby(key string, increment int64, field string) (val int64, err error) + func (s *Redis) Zrange(key string, start, stop int64) (val []string, err error) + func (s *Redis) ZrangeWithScores(key string, start, stop int64) (val []Pair, err error) + func (s *Redis) ZrangebyscoreWithScores(key string, start, stop int64) (val []Pair, err error) + func (s *Redis) ZrangebyscoreWithScoresAndLimit(key string, start, stop int64, page, size int) (val []Pair, err error) + func (s *Redis) Zrank(key, field string) (val int64, err error) + func (s *Redis) Zrem(key string, values ...interface{}) (val int, err error) + func (s *Redis) Zremrangebyrank(key string, start, stop int64) (val int, err error) + func (s *Redis) Zremrangebyscore(key string, start, stop int64) (val int, err error) + func (s *Redis) Zrevrange(key string, start, stop int64) (val []string, err error) + func (s *Redis) ZrevrangebyscoreWithScores(key string, start, stop int64) (val []Pair, err error) + func (s *Redis) ZrevrangebyscoreWithScoresAndLimit(key string, start, stop int64, page, size int) (val []Pair, err error) + func (s *Redis) Zrevrank(key, field string) (val int64, err error) + func (s *Redis) Zscore(key, value string) (val int64, err error) + func (s *Redis) Zunionstore(dest string, store ZStore, keys ...string) (val int64, err error) + type RedisConf struct + Host string + Pass string + Tls bool + Type string + func (rc RedisConf) NewRedis() *Redis + func (rc RedisConf) Validate() error + type RedisKeyConf struct + Key string + func (rkc RedisKeyConf) Validate() error + type RedisLock struct + func NewRedisLock(store *Redis, key string) *RedisLock + func (rl *RedisLock) Acquire() (bool, error) + func (rl *RedisLock) Release() (bool, error) + func (rl *RedisLock) SetExpire(seconds int) + type RedisNode interface + type ScriptCache struct + func GetScriptCache() *ScriptCache + func (sc *ScriptCache) GetSha(script string) (string, bool) + func (sc *ScriptCache) SetSha(script, sha string) + type StringCmd = red.StringCmd + type Z = red.Z + type ZStore = red.ZStore