redis

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 28 Imported by: 245

Documentation

Index

Constants

View Source
const (
	// ClusterType means redis cluster.
	ClusterType = "cluster"
	// NodeType means redis node.
	NodeType = "node"
	// Nil is an alias of redis.Nil.
	Nil = red.Nil
)

Variables

View Source
var (
	// ErrEmptyHost is an error that indicates no redis host is set.
	ErrEmptyHost = errors.New("empty redis host")
	// ErrEmptyType is an error that indicates no redis type is set.
	ErrEmptyType = errors.New("empty redis type")
	// ErrEmptyKey is an error that indicates no redis key is set.
	ErrEmptyKey = errors.New("empty redis key")
)
View Source
var (
	// ErrNilNode is an error that indicates a nil redis node.
	ErrNilNode = errors.New("nil redis node")
)

Functions

func SetSlowThreshold

func SetSlowThreshold(threshold time.Duration)

SetSlowThreshold sets the slow threshold.

Types

type ClosableNode

type ClosableNode interface {
	RedisNode
	Close()
}

ClosableNode interface represents a closable redis node.

func CreateBlockingNode

func CreateBlockingNode(r *Redis) (ClosableNode, error)

CreateBlockingNode returns a ClosableNode.

type FloatCmd

type FloatCmd = red.FloatCmd

FloatCmd is an alias of redis.FloatCmd.

type FloatPair added in v1.4.4

type FloatPair struct {
	Key   string
	Score float64
}

A FloatPair is a key/pair for float set used in redis zet.

type GeoLocation

type GeoLocation = red.GeoLocation

GeoLocation is used with GeoAdd to add geospatial location.

type GeoPos

type GeoPos = red.GeoPos

GeoPos is used to represent a geo position.

type GeoRadiusQuery

type GeoRadiusQuery = red.GeoRadiusQuery

GeoRadiusQuery is used with GeoRadius to query geospatial index.

type IntCmd

type IntCmd = red.IntCmd

IntCmd is an alias of redis.IntCmd.

type Map

type Map map[string]string

Map is an alias of map[string]string.

type Option

type Option func(r *Redis)

Option defines the method to customize a Redis.

func Cluster

func Cluster() Option

Cluster customizes the given Redis as a cluster.

func WithPass

func WithPass(pass string) Option

WithPass customizes the given Redis with given password.

func WithTLS

func WithTLS() Option

WithTLS customizes the given Redis with TLS enabled.

type Pair

type Pair struct {
	Key   string
	Score int64
}

A Pair is a key/pair set used in redis zset.

type Pipeliner

type Pipeliner = red.Pipeliner

Pipeliner is an alias of redis.Pipeliner.

type Redis

type Redis struct {
	Addr string
	Type string
	Pass string
	// contains filtered or unexported fields
}

Redis defines a redis node/cluster. It is thread-safe.

func MustNewRedis added in v1.4.5

func MustNewRedis(conf RedisConf, opts ...Option) *Redis

MustNewRedis returns a Redis with given options.

func New

func New(addr string, opts ...Option) *Redis

New returns a Redis with given options. Deprecated: use MustNewRedis or NewRedis instead.

func NewRedis

func NewRedis(conf RedisConf, opts ...Option) (*Redis, error)

NewRedis returns a Redis with given options.

func (*Redis) BitCount

func (s *Redis) BitCount(key string, start, end int64) (int64, error)

BitCount is redis bitcount command implementation.

func (*Redis) BitCountCtx added in v1.3.1

func (s *Redis) BitCountCtx(ctx context.Context, key string, start, end int64) (int64, error)

BitCountCtx is redis bitcount command implementation.

func (*Redis) BitOpAnd

func (s *Redis) BitOpAnd(destKey string, keys ...string) (int64, error)

BitOpAnd is redis bit operation (and) command implementation.

func (*Redis) BitOpAndCtx added in v1.3.1

func (s *Redis) BitOpAndCtx(ctx context.Context, destKey string, keys ...string) (int64, error)

BitOpAndCtx is redis bit operation (and) command implementation.

func (*Redis) BitOpNot

func (s *Redis) BitOpNot(destKey, key string) (int64, error)

BitOpNot is redis bit operation (not) command implementation.

func (*Redis) BitOpNotCtx added in v1.3.1

func (s *Redis) BitOpNotCtx(ctx context.Context, destKey, key string) (int64, error)

BitOpNotCtx is redis bit operation (not) command implementation.

func (*Redis) BitOpOr

func (s *Redis) BitOpOr(destKey string, keys ...string) (int64, error)

BitOpOr is redis bit operation (or) command implementation.

func (*Redis) BitOpOrCtx added in v1.3.1

func (s *Redis) BitOpOrCtx(ctx context.Context, destKey string, keys ...string) (int64, error)

BitOpOrCtx is redis bit operation (or) command implementation.

func (*Redis) BitOpXor

func (s *Redis) BitOpXor(destKey string, keys ...string) (int64, error)

BitOpXor is redis bit operation (xor) command implementation.

func (*Redis) BitOpXorCtx added in v1.3.1

func (s *Redis) BitOpXorCtx(ctx context.Context, destKey string, keys ...string) (int64, error)

BitOpXorCtx is redis bit operation (xor) command implementation.

func (*Redis) BitPos

func (s *Redis) BitPos(key string, bit, start, end int64) (int64, error)

BitPos is redis bitpos command implementation.

func (*Redis) BitPosCtx added in v1.3.1

func (s *Redis) BitPosCtx(ctx context.Context, key string, bit, start, end int64) (int64, error)

BitPosCtx is redis bitpos command implementation.

func (*Redis) Blpop

func (s *Redis) Blpop(node RedisNode, key string) (string, error)

Blpop uses passed in redis connection to execute blocking queries. Doesn't benefit from pooling redis connections of blocking queries

func (*Redis) BlpopCtx added in v1.3.1

func (s *Redis) BlpopCtx(ctx context.Context, node RedisNode, key string) (string, error)

BlpopCtx uses passed in redis connection to execute blocking queries. Doesn't benefit from pooling redis connections of blocking queries

func (*Redis) BlpopEx

func (s *Redis) BlpopEx(node RedisNode, key string) (string, bool, error)

BlpopEx uses passed in redis connection to execute blpop command. The difference against Blpop is that this method returns a bool to indicate success.

func (*Redis) BlpopExCtx added in v1.3.1

func (s *Redis) BlpopExCtx(ctx context.Context, node RedisNode, key string) (string, bool, error)

BlpopExCtx uses passed in redis connection to execute blpop command. The difference against Blpop is that this method returns a bool to indicate success.

func (*Redis) BlpopWithTimeout added in v1.4.2

func (s *Redis) BlpopWithTimeout(node RedisNode, timeout time.Duration, key string) (string, error)

BlpopWithTimeout uses passed in redis connection to execute blpop command. Control blocking query timeout

func (*Redis) BlpopWithTimeoutCtx added in v1.4.2

func (s *Redis) BlpopWithTimeoutCtx(ctx context.Context, node RedisNode, timeout time.Duration,
	key string) (string, error)

BlpopWithTimeoutCtx uses passed in redis connection to execute blpop command. Control blocking query timeout

func (*Redis) Decr

func (s *Redis) Decr(key string) (int64, error)

Decr is the implementation of redis decr command.

func (*Redis) DecrCtx added in v1.3.1

func (s *Redis) DecrCtx(ctx context.Context, key string) (int64, error)

DecrCtx is the implementation of redis decr command.

func (*Redis) Decrby

func (s *Redis) Decrby(key string, decrement int64) (int64, error)

Decrby is the implementation of redis decrby command.

func (*Redis) DecrbyCtx added in v1.3.1

func (s *Redis) DecrbyCtx(ctx context.Context, key string, decrement int64) (int64, error)

DecrbyCtx is the implementation of redis decrby command.

func (*Redis) Del

func (s *Redis) Del(keys ...string) (int, error)

Del deletes keys.

func (*Redis) DelCtx added in v1.3.1

func (s *Redis) DelCtx(ctx context.Context, keys ...string) (int, error)

DelCtx deletes keys.

func (*Redis) Eval

func (s *Redis) Eval(script string, keys []string, args ...any) (any, error)

Eval is the implementation of redis eval command.

func (*Redis) EvalCtx added in v1.3.1

func (s *Redis) EvalCtx(ctx context.Context, script string, keys []string,
	args ...any) (any, error)

EvalCtx is the implementation of redis eval command.

func (*Redis) EvalSha

func (s *Redis) EvalSha(sha string, keys []string, args ...any) (any, error)

EvalSha is the implementation of redis evalsha command.

func (*Redis) EvalShaCtx added in v1.3.1

func (s *Redis) EvalShaCtx(ctx context.Context, sha string, keys []string,
	args ...any) (any, error)

EvalShaCtx is the implementation of redis evalsha command.

func (*Redis) Exists

func (s *Redis) Exists(key string) (bool, error)

Exists is the implementation of redis exists command.

func (*Redis) ExistsCtx added in v1.3.1

func (s *Redis) ExistsCtx(ctx context.Context, key string) (bool, error)

ExistsCtx is the implementation of redis exists command.

func (*Redis) ExistsMany added in v1.6.1

func (s *Redis) ExistsMany(keys ...string) (int64, error)

ExistsMany is the implementation of redis exists command. checks the existence of multiple keys in Redis using the EXISTS command.

func (*Redis) ExistsManyCtx added in v1.6.1

func (s *Redis) ExistsManyCtx(ctx context.Context, keys ...string) (int64, error)

ExistsManyCtx is the implementation of redis exists command. checks the existence of multiple keys in Redis using the EXISTS command.

func (*Redis) Expire

func (s *Redis) Expire(key string, seconds int) error

Expire is the implementation of redis expire command.

func (*Redis) ExpireCtx added in v1.3.1

func (s *Redis) ExpireCtx(ctx context.Context, key string, seconds int) error

ExpireCtx is the implementation of redis expire command.

func (*Redis) Expireat

func (s *Redis) Expireat(key string, expireTime int64) error

Expireat is the implementation of redis expireat command.

func (*Redis) ExpireatCtx added in v1.3.1

func (s *Redis) ExpireatCtx(ctx context.Context, key string, expireTime int64) error

ExpireatCtx is the implementation of redis expireat command.

func (*Redis) GeoAdd

func (s *Redis) GeoAdd(key string, geoLocation ...*GeoLocation) (int64, error)

GeoAdd is the implementation of redis geoadd command.

func (*Redis) GeoAddCtx added in v1.3.1

func (s *Redis) GeoAddCtx(ctx context.Context, key string, geoLocation ...*GeoLocation) (
	int64, error)

GeoAddCtx is the implementation of redis geoadd command.

func (*Redis) GeoDist

func (s *Redis) GeoDist(key, member1, member2, unit string) (float64, error)

GeoDist is the implementation of redis geodist command.

func (*Redis) GeoDistCtx added in v1.3.1

func (s *Redis) GeoDistCtx(ctx context.Context, key, member1, member2, unit string) (
	float64, error)

GeoDistCtx is the implementation of redis geodist command.

func (*Redis) GeoHash

func (s *Redis) GeoHash(key string, members ...string) ([]string, error)

GeoHash is the implementation of redis geohash command.

func (*Redis) GeoHashCtx added in v1.3.1

func (s *Redis) GeoHashCtx(ctx context.Context, key string, members ...string) (
	[]string, error)

GeoHashCtx is the implementation of redis geohash command.

func (*Redis) GeoPos

func (s *Redis) GeoPos(key string, members ...string) ([]*GeoPos, error)

GeoPos is the implementation of redis geopos command.

func (*Redis) GeoPosCtx added in v1.3.1

func (s *Redis) GeoPosCtx(ctx context.Context, key string, members ...string) (
	[]*GeoPos, error)

GeoPosCtx is the implementation of redis geopos command.

func (*Redis) GeoRadius

func (s *Redis) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) (
	[]GeoLocation, error)

GeoRadius is the implementation of redis georadius command.

func (*Redis) GeoRadiusByMember

func (s *Redis) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) ([]GeoLocation, error)

GeoRadiusByMember is the implementation of redis georadiusbymember command.

func (*Redis) GeoRadiusByMemberCtx added in v1.3.1

func (s *Redis) GeoRadiusByMemberCtx(ctx context.Context, key, member string,
	query *GeoRadiusQuery) ([]GeoLocation, error)

GeoRadiusByMemberCtx is the implementation of redis georadiusbymember command.

func (*Redis) GeoRadiusCtx added in v1.3.1

func (s *Redis) GeoRadiusCtx(ctx context.Context, key string, longitude, latitude float64,
	query *GeoRadiusQuery) ([]GeoLocation, error)

GeoRadiusCtx is the implementation of redis georadius command.

func (*Redis) Get

func (s *Redis) Get(key string) (string, error)

Get is the implementation of redis get command.

func (*Redis) GetBit

func (s *Redis) GetBit(key string, offset int64) (int, error)

GetBit is the implementation of redis getbit command.

func (*Redis) GetBitCtx added in v1.3.1

func (s *Redis) GetBitCtx(ctx context.Context, key string, offset int64) (int, error)

GetBitCtx is the implementation of redis getbit command.

func (*Redis) GetCtx added in v1.3.1

func (s *Redis) GetCtx(ctx context.Context, key string) (string, error)

GetCtx is the implementation of redis get command.

func (*Redis) GetSet added in v1.3.2

func (s *Redis) GetSet(key, value string) (string, error)

GetSet is the implementation of redis getset command.

func (*Redis) GetSetCtx added in v1.3.2

func (s *Redis) GetSetCtx(ctx context.Context, key, value string) (string, error)

GetSetCtx is the implementation of redis getset command.

func (*Redis) Hdel

func (s *Redis) Hdel(key string, fields ...string) (bool, error)

Hdel is the implementation of redis hdel command.

func (*Redis) HdelCtx added in v1.3.1

func (s *Redis) HdelCtx(ctx context.Context, key string, fields ...string) (bool, error)

HdelCtx is the implementation of redis hdel command.

func (*Redis) Hexists

func (s *Redis) Hexists(key, field string) (bool, error)

Hexists is the implementation of redis hexists command.

func (*Redis) HexistsCtx added in v1.3.1

func (s *Redis) HexistsCtx(ctx context.Context, key, field string) (bool, error)

HexistsCtx is the implementation of redis hexists command.

func (*Redis) Hget

func (s *Redis) Hget(key, field string) (string, error)

Hget is the implementation of redis hget command.

func (*Redis) HgetCtx added in v1.3.1

func (s *Redis) HgetCtx(ctx context.Context, key, field string) (string, error)

HgetCtx is the implementation of redis hget command.

func (*Redis) Hgetall

func (s *Redis) Hgetall(key string) (map[string]string, error)

Hgetall is the implementation of redis hgetall command.

func (*Redis) HgetallCtx added in v1.3.1

func (s *Redis) HgetallCtx(ctx context.Context, key string) (map[string]string, error)

HgetallCtx is the implementation of redis hgetall command.

func (*Redis) Hincrby

func (s *Redis) Hincrby(key, field string, increment int) (int, error)

Hincrby is the implementation of redis hincrby command.

func (*Redis) HincrbyCtx added in v1.3.1

func (s *Redis) HincrbyCtx(ctx context.Context, key, field string, increment int) (int, error)

HincrbyCtx is the implementation of redis hincrby command.

func (*Redis) HincrbyFloat added in v1.4.4

func (s *Redis) HincrbyFloat(key, field string, increment float64) (float64, error)

HincrbyFloat is the implementation of redis hincrbyfloat command.

func (*Redis) HincrbyFloatCtx added in v1.4.4

func (s *Redis) HincrbyFloatCtx(ctx context.Context, key, field string, increment float64) (
	float64, error)

HincrbyFloatCtx is the implementation of redis hincrbyfloat command.

func (*Redis) Hkeys

func (s *Redis) Hkeys(key string) ([]string, error)

Hkeys is the implementation of redis hkeys command.

func (*Redis) HkeysCtx added in v1.3.1

func (s *Redis) HkeysCtx(ctx context.Context, key string) ([]string, error)

HkeysCtx is the implementation of redis hkeys command.

func (*Redis) Hlen

func (s *Redis) Hlen(key string) (int, error)

Hlen is the implementation of redis hlen command.

func (*Redis) HlenCtx added in v1.3.1

func (s *Redis) HlenCtx(ctx context.Context, key string) (int, error)

HlenCtx is the implementation of redis hlen command.

func (*Redis) Hmget

func (s *Redis) Hmget(key string, fields ...string) ([]string, error)

Hmget is the implementation of redis hmget command.

func (*Redis) HmgetCtx added in v1.3.1

func (s *Redis) HmgetCtx(ctx context.Context, key string, fields ...string) ([]string, error)

HmgetCtx is the implementation of redis hmget command.

func (*Redis) Hmset

func (s *Redis) Hmset(key string, fieldsAndValues map[string]string) error

Hmset is the implementation of redis hmset command.

func (*Redis) HmsetCtx added in v1.3.1

func (s *Redis) HmsetCtx(ctx context.Context, key string, fieldsAndValues map[string]string) error

HmsetCtx is the implementation of redis hmset command.

func (*Redis) Hscan

func (s *Redis) Hscan(key string, cursor uint64, match string, count int64) (
	[]string, uint64, error)

Hscan is the implementation of redis hscan command.

func (*Redis) HscanCtx added in v1.3.1

func (s *Redis) HscanCtx(ctx context.Context, key string, cursor uint64, match string, count int64) (
	[]string, uint64, error)

HscanCtx is the implementation of redis hscan command.

func (*Redis) Hset

func (s *Redis) Hset(key, field, value string) error

Hset is the implementation of redis hset command.

func (*Redis) HsetCtx added in v1.3.1

func (s *Redis) HsetCtx(ctx context.Context, key, field, value string) error

HsetCtx is the implementation of redis hset command.

func (*Redis) Hsetnx

func (s *Redis) Hsetnx(key, field, value string) (bool, error)

Hsetnx is the implementation of redis hsetnx command.

func (*Redis) HsetnxCtx added in v1.3.1

func (s *Redis) HsetnxCtx(ctx context.Context, key, field, value string) (bool, error)

HsetnxCtx is the implementation of redis hsetnx command.

func (*Redis) Hvals

func (s *Redis) Hvals(key string) ([]string, error)

Hvals is the implementation of redis hvals command.

func (*Redis) HvalsCtx added in v1.3.1

func (s *Redis) HvalsCtx(ctx context.Context, key string) ([]string, error)

HvalsCtx is the implementation of redis hvals command.

func (*Redis) Incr

func (s *Redis) Incr(key string) (int64, error)

Incr is the implementation of redis incr command.

func (*Redis) IncrCtx added in v1.3.1

func (s *Redis) IncrCtx(ctx context.Context, key string) (int64, error)

IncrCtx is the implementation of redis incr command.

func (*Redis) Incrby

func (s *Redis) Incrby(key string, increment int64) (int64, error)

Incrby is the implementation of redis incrby command.

func (*Redis) IncrbyCtx added in v1.3.1

func (s *Redis) IncrbyCtx(ctx context.Context, key string, increment int64) (int64, error)

IncrbyCtx is the implementation of redis incrby command.

func (*Redis) IncrbyFloat added in v1.4.4

func (s *Redis) IncrbyFloat(key string, increment float64) (float64, error)

IncrbyFloat is the implementation of redis hincrbyfloat command.

func (*Redis) IncrbyFloatCtx added in v1.4.4

func (s *Redis) IncrbyFloatCtx(ctx context.Context, key string, increment float64) (float64, error)

IncrbyFloatCtx is the implementation of redis hincrbyfloat command.

func (*Redis) Keys

func (s *Redis) Keys(pattern string) ([]string, error)

Keys is the implementation of redis keys command.

func (*Redis) KeysCtx added in v1.3.1

func (s *Redis) KeysCtx(ctx context.Context, pattern string) ([]string, error)

KeysCtx is the implementation of redis keys command.

func (*Redis) Lindex

func (s *Redis) Lindex(key string, index int64) (string, error)

Lindex is the implementation of redis lindex command.

func (*Redis) LindexCtx added in v1.3.1

func (s *Redis) LindexCtx(ctx context.Context, key string, index int64) (string, error)

LindexCtx is the implementation of redis lindex command.

func (*Redis) Llen

func (s *Redis) Llen(key string) (int, error)

Llen is the implementation of redis llen command.

func (*Redis) LlenCtx added in v1.3.1

func (s *Redis) LlenCtx(ctx context.Context, key string) (int, error)

LlenCtx is the implementation of redis llen command.

func (*Redis) Lpop

func (s *Redis) Lpop(key string) (string, error)

Lpop is the implementation of redis lpop command.

func (*Redis) LpopCount added in v1.5.1

func (s *Redis) LpopCount(key string, count int) ([]string, error)

LpopCount is the implementation of redis lpopCount command.

func (*Redis) LpopCountCtx added in v1.5.1

func (s *Redis) LpopCountCtx(ctx context.Context, key string, count int) ([]string, error)

LpopCountCtx is the implementation of redis lpopCount command.

func (*Redis) LpopCtx added in v1.3.1

func (s *Redis) LpopCtx(ctx context.Context, key string) (string, error)

LpopCtx is the implementation of redis lpop command.

func (*Redis) Lpush

func (s *Redis) Lpush(key string, values ...any) (int, error)

Lpush is the implementation of redis lpush command.

func (*Redis) LpushCtx added in v1.3.1

func (s *Redis) LpushCtx(ctx context.Context, key string, values ...any) (int, error)

LpushCtx is the implementation of redis lpush command.

func (*Redis) Lrange

func (s *Redis) Lrange(key string, start, stop int) ([]string, error)

Lrange is the implementation of redis lrange command.

func (*Redis) LrangeCtx added in v1.3.1

func (s *Redis) LrangeCtx(ctx context.Context, key string, start, stop int) ([]string, error)

LrangeCtx is the implementation of redis lrange command.

func (*Redis) Lrem

func (s *Redis) Lrem(key string, count int, value string) (int, error)

Lrem is the implementation of redis lrem command.

func (*Redis) LremCtx added in v1.3.1

func (s *Redis) LremCtx(ctx context.Context, key string, count int, value string) (int, error)

LremCtx is the implementation of redis lrem command.

func (*Redis) Ltrim

func (s *Redis) Ltrim(key string, start, stop int64) error

Ltrim is the implementation of redis ltrim command.

func (*Redis) LtrimCtx added in v1.3.1

func (s *Redis) LtrimCtx(ctx context.Context, key string, start, stop int64) error

LtrimCtx is the implementation of redis ltrim command.

func (*Redis) Mget

func (s *Redis) Mget(keys ...string) ([]string, error)

Mget is the implementation of redis mget command.

func (*Redis) MgetCtx added in v1.3.1

func (s *Redis) MgetCtx(ctx context.Context, keys ...string) ([]string, error)

MgetCtx is the implementation of redis mget command.

func (*Redis) Mset added in v1.6.3

func (s *Redis) Mset(fieldsAndValues ...any) (string, error)

Mset is the implementation of redis mset command.

func (*Redis) MsetCtx added in v1.6.3

func (s *Redis) MsetCtx(ctx context.Context, fieldsAndValues ...any) (string, error)

MsetCtx is the implementation of redis mset command.

func (*Redis) Persist

func (s *Redis) Persist(key string) (bool, error)

Persist is the implementation of redis persist command.

func (*Redis) PersistCtx added in v1.3.1

func (s *Redis) PersistCtx(ctx context.Context, key string) (bool, error)

PersistCtx is the implementation of redis persist command.

func (*Redis) Pfadd

func (s *Redis) Pfadd(key string, values ...any) (bool, error)

Pfadd is the implementation of redis pfadd command.

func (*Redis) PfaddCtx added in v1.3.1

func (s *Redis) PfaddCtx(ctx context.Context, key string, values ...any) (bool, error)

PfaddCtx is the implementation of redis pfadd command.

func (*Redis) Pfcount

func (s *Redis) Pfcount(key string) (int64, error)

Pfcount is the implementation of redis pfcount command.

func (*Redis) PfcountCtx added in v1.3.1

func (s *Redis) PfcountCtx(ctx context.Context, key string) (int64, error)

PfcountCtx is the implementation of redis pfcount command.

func (*Redis) Pfmerge

func (s *Redis) Pfmerge(dest string, keys ...string) error

Pfmerge is the implementation of redis pfmerge command.

func (*Redis) PfmergeCtx added in v1.3.1

func (s *Redis) PfmergeCtx(ctx context.Context, dest string, keys ...string) error

PfmergeCtx is the implementation of redis pfmerge command.

func (*Redis) Ping

func (s *Redis) Ping() bool

Ping is the implementation of redis ping command.

func (*Redis) PingCtx added in v1.3.1

func (s *Redis) PingCtx(ctx context.Context) bool

PingCtx is the implementation of redis ping command.

func (*Redis) Pipelined

func (s *Redis) Pipelined(fn func(Pipeliner) error) error

Pipelined lets fn execute pipelined commands.

func (*Redis) PipelinedCtx added in v1.3.1

func (s *Redis) PipelinedCtx(ctx context.Context, fn func(Pipeliner) error) error

PipelinedCtx lets fn execute pipelined commands. Results need to be retrieved by calling Pipeline.Exec()

func (*Redis) Rpop

func (s *Redis) Rpop(key string) (string, error)

Rpop is the implementation of redis rpop command.

func (*Redis) RpopCount added in v1.5.1

func (s *Redis) RpopCount(key string, count int) ([]string, error)

RpopCount is the implementation of redis rpopCount command.

func (*Redis) RpopCountCtx added in v1.5.1

func (s *Redis) RpopCountCtx(ctx context.Context, key string, count int) ([]string, error)

RpopCountCtx is the implementation of redis rpopCount command.

func (*Redis) RpopCtx added in v1.3.1

func (s *Redis) RpopCtx(ctx context.Context, key string) (string, error)

RpopCtx is the implementation of redis rpop command.

func (*Redis) Rpush

func (s *Redis) Rpush(key string, values ...any) (int, error)

Rpush is the implementation of redis rpush command.

func (*Redis) RpushCtx added in v1.3.1

func (s *Redis) RpushCtx(ctx context.Context, key string, values ...any) (int, error)

RpushCtx is the implementation of redis rpush command.

func (*Redis) Sadd

func (s *Redis) Sadd(key string, values ...any) (int, error)

Sadd is the implementation of redis sadd command.

func (*Redis) SaddCtx added in v1.3.1

func (s *Redis) SaddCtx(ctx context.Context, key string, values ...any) (int, error)

SaddCtx is the implementation of redis sadd command.

func (*Redis) Scan

func (s *Redis) Scan(cursor uint64, match string, count int64) ([]string, uint64, error)

Scan is the implementation of redis scan command.

func (*Redis) ScanCtx added in v1.3.1

func (s *Redis) ScanCtx(ctx context.Context, cursor uint64, match string, count int64) (
	[]string, uint64, error)

ScanCtx is the implementation of redis scan command.

func (*Redis) Scard

func (s *Redis) Scard(key string) (int64, error)

Scard is the implementation of redis scard command.

func (*Redis) ScardCtx added in v1.3.1

func (s *Redis) ScardCtx(ctx context.Context, key string) (int64, error)

ScardCtx is the implementation of redis scard command.

func (*Redis) ScriptLoad

func (s *Redis) ScriptLoad(script string) (string, error)

ScriptLoad is the implementation of redis script load command.

func (*Redis) ScriptLoadCtx added in v1.3.1

func (s *Redis) ScriptLoadCtx(ctx context.Context, script string) (string, error)

ScriptLoadCtx is the implementation of redis script load command.

func (*Redis) ScriptRun added in v1.5.1

func (s *Redis) ScriptRun(script *Script, keys []string, args ...any) (any, error)

ScriptRun is the implementation of *redis.Script run command.

func (*Redis) ScriptRunCtx added in v1.5.1

func (s *Redis) ScriptRunCtx(ctx context.Context, script *Script, keys []string,
	args ...any) (any, error)

ScriptRunCtx is the implementation of *redis.Script run command.

func (*Redis) Sdiff

func (s *Redis) Sdiff(keys ...string) ([]string, error)

Sdiff is the implementation of redis sdiff command.

func (*Redis) SdiffCtx added in v1.3.1

func (s *Redis) SdiffCtx(ctx context.Context, keys ...string) ([]string, error)

SdiffCtx is the implementation of redis sdiff command.

func (*Redis) Sdiffstore

func (s *Redis) Sdiffstore(destination string, keys ...string) (int, error)

Sdiffstore is the implementation of redis sdiffstore command.

func (*Redis) SdiffstoreCtx added in v1.3.1

func (s *Redis) SdiffstoreCtx(ctx context.Context, destination string, keys ...string) (
	int, error)

SdiffstoreCtx is the implementation of redis sdiffstore command.

func (*Redis) Set

func (s *Redis) Set(key, value string) error

Set is the implementation of redis set command.

func (*Redis) SetBit

func (s *Redis) SetBit(key string, offset int64, value int) (int, error)

SetBit is the implementation of redis setbit command.

func (*Redis) SetBitCtx added in v1.3.1

func (s *Redis) SetBitCtx(ctx context.Context, key string, offset int64, value int) (int, error)

SetBitCtx is the implementation of redis setbit command.

func (*Redis) SetCtx added in v1.3.1

func (s *Redis) SetCtx(ctx context.Context, key, value string) error

SetCtx is the implementation of redis set command.

func (*Redis) Setex

func (s *Redis) Setex(key, value string, seconds int) error

Setex is the implementation of redis setex command.

func (*Redis) SetexCtx added in v1.3.1

func (s *Redis) SetexCtx(ctx context.Context, key, value string, seconds int) error

SetexCtx is the implementation of redis setex command.

func (*Redis) Setnx

func (s *Redis) Setnx(key, value string) (bool, error)

Setnx is the implementation of redis setnx command.

func (*Redis) SetnxCtx added in v1.3.1

func (s *Redis) SetnxCtx(ctx context.Context, key, value string) (bool, error)

SetnxCtx is the implementation of redis setnx command.

func (*Redis) SetnxEx

func (s *Redis) SetnxEx(key, value string, seconds int) (bool, error)

SetnxEx is the implementation of redis setnx command with expire.

func (*Redis) SetnxExCtx added in v1.3.1

func (s *Redis) SetnxExCtx(ctx context.Context, key, value string, seconds int) (bool, error)

SetnxExCtx is the implementation of redis setnx command with expire.

func (*Redis) Sinter

func (s *Redis) Sinter(keys ...string) ([]string, error)

Sinter is the implementation of redis sinter command.

func (*Redis) SinterCtx added in v1.3.1

func (s *Redis) SinterCtx(ctx context.Context, keys ...string) ([]string, error)

SinterCtx is the implementation of redis sinter command.

func (*Redis) Sinterstore

func (s *Redis) Sinterstore(destination string, keys ...string) (int, error)

Sinterstore is the implementation of redis sinterstore command.

func (*Redis) SinterstoreCtx added in v1.3.1

func (s *Redis) SinterstoreCtx(ctx context.Context, destination string, keys ...string) (
	int, error)

SinterstoreCtx is the implementation of redis sinterstore command.

func (*Redis) Sismember

func (s *Redis) Sismember(key string, value any) (bool, error)

Sismember is the implementation of redis sismember command.

func (*Redis) SismemberCtx added in v1.3.1

func (s *Redis) SismemberCtx(ctx context.Context, key string, value any) (bool, error)

SismemberCtx is the implementation of redis sismember command.

func (*Redis) Smembers

func (s *Redis) Smembers(key string) ([]string, error)

Smembers is the implementation of redis smembers command.

func (*Redis) SmembersCtx added in v1.3.1

func (s *Redis) SmembersCtx(ctx context.Context, key string) ([]string, error)

SmembersCtx is the implementation of redis smembers command.

func (*Redis) Spop

func (s *Redis) Spop(key string) (string, error)

Spop is the implementation of redis spop command.

func (*Redis) SpopCtx added in v1.3.1

func (s *Redis) SpopCtx(ctx context.Context, key string) (string, error)

SpopCtx is the implementation of redis spop command.

func (*Redis) Srandmember

func (s *Redis) Srandmember(key string, count int) ([]string, error)

Srandmember is the implementation of redis srandmember command.

func (*Redis) SrandmemberCtx added in v1.3.1

func (s *Redis) SrandmemberCtx(ctx context.Context, key string, count int) ([]string, error)

SrandmemberCtx is the implementation of redis srandmember command.

func (*Redis) Srem

func (s *Redis) Srem(key string, values ...any) (int, error)

Srem is the implementation of redis srem command.

func (*Redis) SremCtx added in v1.3.1

func (s *Redis) SremCtx(ctx context.Context, key string, values ...any) (int, error)

SremCtx is the implementation of redis srem command.

func (*Redis) Sscan

func (s *Redis) Sscan(key string, cursor uint64, match string, count int64) (
	[]string, uint64, error)

Sscan is the implementation of redis sscan command.

func (*Redis) SscanCtx added in v1.3.1

func (s *Redis) SscanCtx(ctx context.Context, key string, cursor uint64, match string, count int64) (
	[]string, uint64, error)

SscanCtx is the implementation of redis sscan command.

func (*Redis) String

func (s *Redis) String() string

String returns the string representation of s.

func (*Redis) Sunion

func (s *Redis) Sunion(keys ...string) ([]string, error)

Sunion is the implementation of redis sunion command.

func (*Redis) SunionCtx added in v1.3.1

func (s *Redis) SunionCtx(ctx context.Context, keys ...string) ([]string, error)

SunionCtx is the implementation of redis sunion command.

func (*Redis) Sunionstore

func (s *Redis) Sunionstore(destination string, keys ...string) (int, error)

Sunionstore is the implementation of redis sunionstore command.

func (*Redis) SunionstoreCtx added in v1.3.1

func (s *Redis) SunionstoreCtx(ctx context.Context, destination string, keys ...string) (
	int, error)

SunionstoreCtx is the implementation of redis sunionstore command.

func (*Redis) Ttl

func (s *Redis) Ttl(key string) (int, error)

Ttl is the implementation of redis ttl command.

func (*Redis) TtlCtx added in v1.3.1

func (s *Redis) TtlCtx(ctx context.Context, key string) (int, error)

TtlCtx is the implementation of redis ttl command.

func (*Redis) ZRevRangeWithScores

func (s *Redis) ZRevRangeWithScores(key string, start, stop int64) ([]Pair, error)

ZRevRangeWithScores is the implementation of redis zrevrange command with scores. Deprecated: use ZrevrangeWithScores instead.

func (*Redis) ZRevRangeWithScoresByFloat added in v1.4.4

func (s *Redis) ZRevRangeWithScoresByFloat(key string, start, stop int64) ([]FloatPair, error)

ZRevRangeWithScoresByFloat is the implementation of redis zrevrange command with scores by float. Deprecated: use ZrevrangeWithScoresByFloat instead.

func (*Redis) ZRevRangeWithScoresByFloatCtx added in v1.4.4

func (s *Redis) ZRevRangeWithScoresByFloatCtx(ctx context.Context, key string, start, stop int64) (
	[]FloatPair, error)

ZRevRangeWithScoresByFloatCtx is the implementation of redis zrevrange command with scores by float. Deprecated: use ZrevrangeWithScoresByFloatCtx instead.

func (*Redis) ZRevRangeWithScoresCtx added in v1.3.1

func (s *Redis) ZRevRangeWithScoresCtx(ctx context.Context, key string, start, stop int64) (
	[]Pair, error)

ZRevRangeWithScoresCtx is the implementation of redis zrevrange command with scores. Deprecated: use ZrevrangeWithScoresCtx instead.

func (*Redis) Zadd

func (s *Redis) Zadd(key string, score int64, value string) (bool, error)

Zadd is the implementation of redis zadd command.

func (*Redis) ZaddCtx added in v1.3.1

func (s *Redis) ZaddCtx(ctx context.Context, key string, score int64, value string) (bool, error)

ZaddCtx is the implementation of redis zadd command.

func (*Redis) ZaddFloat added in v1.4.1

func (s *Redis) ZaddFloat(key string, score float64, value string) (bool, error)

ZaddFloat is the implementation of redis zadd command.

func (*Redis) ZaddFloatCtx added in v1.4.1

func (s *Redis) ZaddFloatCtx(ctx context.Context, key string, score float64, value string) (
	bool, error)

ZaddFloatCtx is the implementation of redis zadd command.

func (*Redis) Zaddnx added in v1.6.3

func (s *Redis) Zaddnx(key string, score int64, value string) (bool, error)

Zaddnx is the implementation of redis zadd nx command.

func (*Redis) ZaddnxCtx added in v1.6.3

func (s *Redis) ZaddnxCtx(ctx context.Context, key string, score int64, value string) (bool, error)

ZaddnxCtx is the implementation of redis zadd nx command.

func (*Redis) ZaddnxFloat added in v1.6.3

func (s *Redis) ZaddnxFloat(key string, score float64, value string) (bool, error)

ZaddnxFloat is the implementation of redis zaddnx command.

func (*Redis) ZaddnxFloatCtx added in v1.6.3

func (s *Redis) ZaddnxFloatCtx(ctx context.Context, key string, score float64, value string) (
	bool, error)

ZaddnxFloatCtx is the implementation of redis zaddnx command.

func (*Redis) Zadds

func (s *Redis) Zadds(key string, ps ...Pair) (int64, error)

Zadds is the implementation of redis zadds command.

func (*Redis) ZaddsCtx added in v1.3.1

func (s *Redis) ZaddsCtx(ctx context.Context, key string, ps ...Pair) (int64, error)

ZaddsCtx is the implementation of redis zadds command.

func (*Redis) Zcard

func (s *Redis) Zcard(key string) (int, error)

Zcard is the implementation of redis zcard command.

func (*Redis) ZcardCtx added in v1.3.1

func (s *Redis) ZcardCtx(ctx context.Context, key string) (int, error)

ZcardCtx is the implementation of redis zcard command.

func (*Redis) Zcount

func (s *Redis) Zcount(key string, start, stop int64) (int, error)

Zcount is the implementation of redis zcount command.

func (*Redis) ZcountCtx added in v1.3.1

func (s *Redis) ZcountCtx(ctx context.Context, key string, start, stop int64) (int, error)

ZcountCtx is the implementation of redis zcount command.

func (*Redis) Zincrby

func (s *Redis) Zincrby(key string, increment int64, field string) (int64, error)

Zincrby is the implementation of redis zincrby command.

func (*Redis) ZincrbyCtx added in v1.3.1

func (s *Redis) ZincrbyCtx(ctx context.Context, key string, increment int64, field string) (
	int64, error)

ZincrbyCtx is the implementation of redis zincrby command.

func (*Redis) Zrange

func (s *Redis) Zrange(key string, start, stop int64) ([]string, error)

Zrange is the implementation of redis zrange command.

func (*Redis) ZrangeCtx added in v1.3.1

func (s *Redis) ZrangeCtx(ctx context.Context, key string, start, stop int64) (
	[]string, error)

ZrangeCtx is the implementation of redis zrange command.

func (*Redis) ZrangeWithScores

func (s *Redis) ZrangeWithScores(key string, start, stop int64) ([]Pair, error)

ZrangeWithScores is the implementation of redis zrange command with scores.

func (*Redis) ZrangeWithScoresByFloat added in v1.4.4

func (s *Redis) ZrangeWithScoresByFloat(key string, start, stop int64) ([]FloatPair, error)

ZrangeWithScoresByFloat is the implementation of redis zrange command with scores by float64.

func (*Redis) ZrangeWithScoresByFloatCtx added in v1.4.4

func (s *Redis) ZrangeWithScoresByFloatCtx(ctx context.Context, key string, start, stop int64) (
	[]FloatPair, error)

ZrangeWithScoresByFloatCtx is the implementation of redis zrange command with scores by float64.

func (*Redis) ZrangeWithScoresCtx added in v1.3.1

func (s *Redis) ZrangeWithScoresCtx(ctx context.Context, key string, start, stop int64) (
	[]Pair, error)

ZrangeWithScoresCtx is the implementation of redis zrange command with scores.

func (*Redis) ZrangebyscoreWithScores

func (s *Redis) ZrangebyscoreWithScores(key string, start, stop int64) ([]Pair, error)

ZrangebyscoreWithScores is the implementation of redis zrangebyscore command with scores.

func (*Redis) ZrangebyscoreWithScoresAndLimit

func (s *Redis) ZrangebyscoreWithScoresAndLimit(key string, start, stop int64,
	page, size int) ([]Pair, error)

ZrangebyscoreWithScoresAndLimit is the implementation of redis zrangebyscore command with scores and limit.

func (*Redis) ZrangebyscoreWithScoresAndLimitCtx added in v1.3.1

func (s *Redis) ZrangebyscoreWithScoresAndLimitCtx(ctx context.Context, key string, start,
	stop int64, page, size int) ([]Pair, error)

ZrangebyscoreWithScoresAndLimitCtx is the implementation of redis zrangebyscore command with scores and limit.

func (*Redis) ZrangebyscoreWithScoresByFloat added in v1.4.4

func (s *Redis) ZrangebyscoreWithScoresByFloat(key string, start, stop float64) (
	[]FloatPair, error)

ZrangebyscoreWithScoresByFloat is the implementation of redis zrangebyscore command with scores by float.

func (*Redis) ZrangebyscoreWithScoresByFloatAndLimit added in v1.4.4

func (s *Redis) ZrangebyscoreWithScoresByFloatAndLimit(key string, start, stop float64,
	page, size int) ([]FloatPair, error)

ZrangebyscoreWithScoresByFloatAndLimit is the implementation of redis zrangebyscore command with scores by float and limit.

func (*Redis) ZrangebyscoreWithScoresByFloatAndLimitCtx added in v1.4.4

func (s *Redis) ZrangebyscoreWithScoresByFloatAndLimitCtx(ctx context.Context, key string, start,
	stop float64, page, size int) ([]FloatPair, error)

ZrangebyscoreWithScoresByFloatAndLimitCtx is the implementation of redis zrangebyscore command with scores by float and limit.

func (*Redis) ZrangebyscoreWithScoresByFloatCtx added in v1.4.4

func (s *Redis) ZrangebyscoreWithScoresByFloatCtx(ctx context.Context, key string, start, stop float64) (
	[]FloatPair, error)

ZrangebyscoreWithScoresByFloatCtx is the implementation of redis zrangebyscore command with scores by float.

func (*Redis) ZrangebyscoreWithScoresCtx added in v1.3.1

func (s *Redis) ZrangebyscoreWithScoresCtx(ctx context.Context, key string, start, stop int64) (
	[]Pair, error)

ZrangebyscoreWithScoresCtx is the implementation of redis zrangebyscore command with scores.

func (*Redis) Zrank

func (s *Redis) Zrank(key, field string) (int64, error)

Zrank is the implementation of redis zrank command.

func (*Redis) ZrankCtx added in v1.3.1

func (s *Redis) ZrankCtx(ctx context.Context, key, field string) (int64, error)

ZrankCtx is the implementation of redis zrank command.

func (*Redis) Zrem

func (s *Redis) Zrem(key string, values ...any) (int, error)

Zrem is the implementation of redis zrem command.

func (*Redis) ZremCtx added in v1.3.1

func (s *Redis) ZremCtx(ctx context.Context, key string, values ...any) (int, error)

ZremCtx is the implementation of redis zrem command.

func (*Redis) Zremrangebyrank

func (s *Redis) Zremrangebyrank(key string, start, stop int64) (int, error)

Zremrangebyrank is the implementation of redis zremrangebyrank command.

func (*Redis) ZremrangebyrankCtx added in v1.3.1

func (s *Redis) ZremrangebyrankCtx(ctx context.Context, key string, start, stop int64) (
	int, error)

ZremrangebyrankCtx is the implementation of redis zremrangebyrank command.

func (*Redis) Zremrangebyscore

func (s *Redis) Zremrangebyscore(key string, start, stop int64) (int, error)

Zremrangebyscore is the implementation of redis zremrangebyscore command.

func (*Redis) ZremrangebyscoreCtx added in v1.3.1

func (s *Redis) ZremrangebyscoreCtx(ctx context.Context, key string, start, stop int64) (
	int, error)

ZremrangebyscoreCtx is the implementation of redis zremrangebyscore command.

func (*Redis) Zrevrange

func (s *Redis) Zrevrange(key string, start, stop int64) ([]string, error)

Zrevrange is the implementation of redis zrevrange command.

func (*Redis) ZrevrangeCtx added in v1.3.1

func (s *Redis) ZrevrangeCtx(ctx context.Context, key string, start, stop int64) (
	[]string, error)

ZrevrangeCtx is the implementation of redis zrevrange command.

func (*Redis) ZrevrangeWithScores added in v1.4.4

func (s *Redis) ZrevrangeWithScores(key string, start, stop int64) ([]Pair, error)

ZrevrangeWithScores is the implementation of redis zrevrange command with scores.

func (*Redis) ZrevrangeWithScoresByFloat added in v1.4.4

func (s *Redis) ZrevrangeWithScoresByFloat(key string, start, stop int64) ([]FloatPair, error)

ZrevrangeWithScoresByFloat is the implementation of redis zrevrange command with scores by float.

func (*Redis) ZrevrangeWithScoresByFloatCtx added in v1.4.4

func (s *Redis) ZrevrangeWithScoresByFloatCtx(ctx context.Context, key string, start, stop int64) (
	[]FloatPair, error)

ZrevrangeWithScoresByFloatCtx is the implementation of redis zrevrange command with scores by float.

func (*Redis) ZrevrangeWithScoresCtx added in v1.4.4

func (s *Redis) ZrevrangeWithScoresCtx(ctx context.Context, key string, start, stop int64) (
	[]Pair, error)

ZrevrangeWithScoresCtx is the implementation of redis zrevrange command with scores.

func (*Redis) ZrevrangebyscoreWithScores

func (s *Redis) ZrevrangebyscoreWithScores(key string, start, stop int64) ([]Pair, error)

ZrevrangebyscoreWithScores is the implementation of redis zrevrangebyscore command with scores.

func (*Redis) ZrevrangebyscoreWithScoresAndLimit

func (s *Redis) ZrevrangebyscoreWithScoresAndLimit(key string, start, stop int64,
	page, size int) ([]Pair, error)

ZrevrangebyscoreWithScoresAndLimit is the implementation of redis zrevrangebyscore command with scores and limit.

func (*Redis) ZrevrangebyscoreWithScoresAndLimitCtx added in v1.3.1

func (s *Redis) ZrevrangebyscoreWithScoresAndLimitCtx(ctx context.Context, key string,
	start, stop int64, page, size int) ([]Pair, error)

ZrevrangebyscoreWithScoresAndLimitCtx is the implementation of redis zrevrangebyscore command with scores and limit.

func (*Redis) ZrevrangebyscoreWithScoresByFloat added in v1.4.4

func (s *Redis) ZrevrangebyscoreWithScoresByFloat(key string, start, stop float64) (
	[]FloatPair, error)

ZrevrangebyscoreWithScoresByFloat is the implementation of redis zrevrangebyscore command with scores by float.

func (*Redis) ZrevrangebyscoreWithScoresByFloatAndLimit added in v1.4.4

func (s *Redis) ZrevrangebyscoreWithScoresByFloatAndLimit(key string, start, stop float64,
	page, size int) ([]FloatPair, error)

ZrevrangebyscoreWithScoresByFloatAndLimit is the implementation of redis zrevrangebyscore command with scores by float and limit.

func (*Redis) ZrevrangebyscoreWithScoresByFloatAndLimitCtx added in v1.4.4

func (s *Redis) ZrevrangebyscoreWithScoresByFloatAndLimitCtx(ctx context.Context, key string,
	start, stop float64, page, size int) ([]FloatPair, error)

ZrevrangebyscoreWithScoresByFloatAndLimitCtx is the implementation of redis zrevrangebyscore command with scores by float and limit.

func (*Redis) ZrevrangebyscoreWithScoresByFloatCtx added in v1.4.4

func (s *Redis) ZrevrangebyscoreWithScoresByFloatCtx(ctx context.Context, key string,
	start, stop float64) ([]FloatPair, error)

ZrevrangebyscoreWithScoresByFloatCtx is the implementation of redis zrevrangebyscore command with scores by float.

func (*Redis) ZrevrangebyscoreWithScoresCtx added in v1.3.1

func (s *Redis) ZrevrangebyscoreWithScoresCtx(ctx context.Context, key string, start, stop int64) (
	[]Pair, error)

ZrevrangebyscoreWithScoresCtx is the implementation of redis zrevrangebyscore command with scores.

func (*Redis) Zrevrank

func (s *Redis) Zrevrank(key, field string) (int64, error)

Zrevrank is the implementation of redis zrevrank command.

func (*Redis) ZrevrankCtx added in v1.3.1

func (s *Redis) ZrevrankCtx(ctx context.Context, key, field string) (int64, error)

ZrevrankCtx is the implementation of redis zrevrank command.

func (*Redis) Zscan added in v1.4.4

func (s *Redis) Zscan(key string, cursor uint64, match string, count int64) (
	[]string, uint64, error)

Zscan is the implementation of redis zscan command.

func (*Redis) ZscanCtx added in v1.4.4

func (s *Redis) ZscanCtx(ctx context.Context, key string, cursor uint64, match string, count int64) (
	[]string, uint64, error)

ZscanCtx is the implementation of redis zscan command.

func (*Redis) Zscore

func (s *Redis) Zscore(key, value string) (int64, error)

Zscore is the implementation of redis zscore command.

func (*Redis) ZscoreByFloat added in v1.4.4

func (s *Redis) ZscoreByFloat(key, value string) (float64, error)

ZscoreByFloat is the implementation of redis zscore command score by float.

func (*Redis) ZscoreByFloatCtx added in v1.4.4

func (s *Redis) ZscoreByFloatCtx(ctx context.Context, key, value string) (float64, error)

ZscoreByFloatCtx is the implementation of redis zscore command score by float.

func (*Redis) ZscoreCtx added in v1.3.1

func (s *Redis) ZscoreCtx(ctx context.Context, key, value string) (int64, error)

ZscoreCtx is the implementation of redis zscore command.

func (*Redis) Zunionstore

func (s *Redis) Zunionstore(dest string, store *ZStore) (int64, error)

Zunionstore is the implementation of redis zunionstore command.

func (*Redis) ZunionstoreCtx added in v1.3.1

func (s *Redis) ZunionstoreCtx(ctx context.Context, dest string, store *ZStore) (
	int64, error)

ZunionstoreCtx is the implementation of redis zunionstore command.

type RedisConf

type RedisConf struct {
	Host     string
	Type     string `json:",default=node,options=node|cluster"`
	Pass     string `json:",optional"`
	Tls      bool   `json:",optional"`
	NonBlock bool   `json:",default=true"`
	// PingTimeout is the timeout for ping redis.
	PingTimeout time.Duration `json:",default=1s"`
}

A RedisConf is a redis config.

func (RedisConf) NewRedis

func (rc RedisConf) NewRedis() *Redis

NewRedis returns a Redis. Deprecated: use MustNewRedis or NewRedis instead.

func (RedisConf) Validate

func (rc RedisConf) Validate() error

Validate validates the RedisConf.

type RedisKeyConf

type RedisKeyConf struct {
	RedisConf
	Key string
}

A RedisKeyConf is a redis config with key.

func (RedisKeyConf) Validate

func (rkc RedisKeyConf) Validate() error

Validate validates the RedisKeyConf.

type RedisLock

type RedisLock struct {
	// contains filtered or unexported fields
}

A RedisLock is a redis lock.

func NewRedisLock

func NewRedisLock(store *Redis, key string) *RedisLock

NewRedisLock returns a RedisLock.

func (*RedisLock) Acquire

func (rl *RedisLock) Acquire() (bool, error)

Acquire acquires the lock.

func (*RedisLock) AcquireCtx added in v1.4.0

func (rl *RedisLock) AcquireCtx(ctx context.Context) (bool, error)

AcquireCtx acquires the lock with the given ctx.

func (*RedisLock) Release

func (rl *RedisLock) Release() (bool, error)

Release releases the lock.

func (*RedisLock) ReleaseCtx added in v1.4.0

func (rl *RedisLock) ReleaseCtx(ctx context.Context) (bool, error)

ReleaseCtx releases the lock with the given ctx.

func (*RedisLock) SetExpire

func (rl *RedisLock) SetExpire(seconds int)

SetExpire sets the expiration.

type RedisNode

type RedisNode interface {
	red.Cmdable
	red.BitMapCmdable
}

RedisNode interface represents a redis node.

type Script added in v1.5.1

type Script = red.Script

Script is an alias of redis.Script.

func NewScript added in v1.5.1

func NewScript(script string) *Script

NewScript returns a new Script instance.

type ScriptCache

type ScriptCache struct {
	atomic.Value
}

A ScriptCache is a cache that stores a script with its sha key.

func GetScriptCache

func GetScriptCache() *ScriptCache

GetScriptCache returns a ScriptCache.

func (*ScriptCache) GetSha

func (sc *ScriptCache) GetSha(script string) (string, bool)

GetSha returns the sha string of given script.

func (*ScriptCache) SetSha

func (sc *ScriptCache) SetSha(script, sha string)

SetSha sets script with sha into the ScriptCache.

type StringCmd

type StringCmd = red.StringCmd

StringCmd is an alias of redis.StringCmd.

type Z

type Z = red.Z

Z represents sorted set member.

type ZStore

type ZStore = red.ZStore

ZStore is an alias of redis.ZStore.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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