Versions in this module Expand all Collapse all v2 v2.7.2 Aug 2, 2024 Changes in this version + const DefaultGroupName + func ClearConfig() + func RegisterAdapterFunc(adapterFunc AdapterFunc) + func RemoveConfig(name ...string) + func SetConfig(config *Config, name ...string) + func SetConfigByMap(m map[string]interface{}, name ...string) error + type Adapter interface + type AdapterFunc func(config *Config) Adapter + type AdapterGroup interface + GroupGeneric func() IGroupGeneric + GroupHash func() IGroupHash + GroupList func() IGroupList + GroupPubSub func() IGroupPubSub + GroupScript func() IGroupScript + GroupSet func() IGroupSet + GroupSortedSet func() IGroupSortedSet + GroupString func() IGroupString + type AdapterOperation interface + Close func(ctx context.Context) (err error) + Conn func(ctx context.Context) (conn Conn, err error) + Do func(ctx context.Context, command string, args ...interface{}) (*gvar.Var, error) + type Config struct + Address string + Cluster bool + Db int + DialTimeout time.Duration + IdleTimeout time.Duration + MasterName string + MaxActive int + MaxConnLifetime time.Duration + MaxIdle int + MinIdle int + Pass string + Protocol int + ReadTimeout time.Duration + SentinelPass string + SentinelUser string + SlaveOnly bool + TLS bool + TLSConfig *tls.Config + TLSSkipVerify bool + User string + WaitTimeout time.Duration + WriteTimeout time.Duration + func ConfigFromMap(m map[string]interface{}) (config *Config, err error) + func GetConfig(name ...string) (config *Config, ok bool) + type Conn interface + Close func(ctx context.Context) (err error) + Do func(ctx context.Context, command string, args ...interface{}) (result *gvar.Var, err error) + type ConnCommand interface + PSubscribe func(ctx context.Context, pattern string, patterns ...string) ([]*Subscription, error) + Receive func(ctx context.Context) (result *gvar.Var, err error) + ReceiveMessage func(ctx context.Context) (*Message, error) + Subscribe func(ctx context.Context, channel string, channels ...string) ([]*Subscription, error) + type CopyOption struct + DB int + REPLACE bool + type ExpireOption struct + GT bool + LT bool + NX bool + XX bool + type FlushOp string + const FlushAsync + const FlushSync + type GetEXOption struct + Persist bool + type IGroupGeneric interface + Copy func(ctx context.Context, source, destination string, option ...CopyOption) (int64, error) + DBSize func(ctx context.Context) (int64, error) + Del func(ctx context.Context, keys ...string) (int64, error) + Exists func(ctx context.Context, keys ...string) (int64, error) + Expire func(ctx context.Context, key string, seconds int64, option ...ExpireOption) (int64, error) + ExpireAt func(ctx context.Context, key string, time time.Time, option ...ExpireOption) (int64, error) + ExpireTime func(ctx context.Context, key string) (*gvar.Var, error) + FlushAll func(ctx context.Context, option ...FlushOp) error + FlushDB func(ctx context.Context, option ...FlushOp) error + Keys func(ctx context.Context, pattern string) ([]string, error) + Move func(ctx context.Context, key string, db int) (int64, error) + PExpire func(ctx context.Context, key string, milliseconds int64, option ...ExpireOption) (int64, error) + PExpireAt func(ctx context.Context, key string, time time.Time, option ...ExpireOption) (int64, error) + PExpireTime func(ctx context.Context, key string) (*gvar.Var, error) + PTTL func(ctx context.Context, key string) (int64, error) + Persist func(ctx context.Context, key string) (int64, error) + RandomKey func(ctx context.Context) (string, error) + Rename func(ctx context.Context, key, newKey string) error + RenameNX func(ctx context.Context, key, newKey string) (int64, error) + Scan func(ctx context.Context, cursor uint64, option ...ScanOption) (uint64, []string, error) + TTL func(ctx context.Context, key string) (int64, error) + Type func(ctx context.Context, key string) (string, error) + Unlink func(ctx context.Context, keys ...string) (int64, error) + type IGroupHash interface + HDel func(ctx context.Context, key string, fields ...string) (int64, error) + HExists func(ctx context.Context, key, field string) (int64, error) + HGet func(ctx context.Context, key, field string) (*gvar.Var, error) + HGetAll func(ctx context.Context, key string) (*gvar.Var, error) + HIncrBy func(ctx context.Context, key, field string, increment int64) (int64, error) + HIncrByFloat func(ctx context.Context, key, field string, increment float64) (float64, error) + HKeys func(ctx context.Context, key string) ([]string, error) + HLen func(ctx context.Context, key string) (int64, error) + HMGet func(ctx context.Context, key string, fields ...string) (gvar.Vars, error) + HMSet func(ctx context.Context, key string, fields map[string]interface{}) error + HSet func(ctx context.Context, key string, fields map[string]interface{}) (int64, error) + HSetNX func(ctx context.Context, key, field string, value interface{}) (int64, error) + HStrLen func(ctx context.Context, key, field string) (int64, error) + HVals func(ctx context.Context, key string) (gvar.Vars, error) + type IGroupList interface + BLPop func(ctx context.Context, timeout int64, keys ...string) (gvar.Vars, error) + BRPop func(ctx context.Context, timeout int64, keys ...string) (gvar.Vars, error) + BRPopLPush func(ctx context.Context, source, destination string, timeout int64) (*gvar.Var, error) + LIndex func(ctx context.Context, key string, index int64) (*gvar.Var, error) + LInsert func(ctx context.Context, key string, op LInsertOp, pivot, value interface{}) (int64, error) + LLen func(ctx context.Context, key string) (int64, error) + LPop func(ctx context.Context, key string, count ...int) (*gvar.Var, error) + LPush func(ctx context.Context, key string, values ...interface{}) (int64, error) + LPushX func(ctx context.Context, key string, element interface{}, elements ...interface{}) (int64, error) + LRange func(ctx context.Context, key string, start, stop int64) (gvar.Vars, error) + LRem func(ctx context.Context, key string, count int64, value interface{}) (int64, error) + LSet func(ctx context.Context, key string, index int64, value interface{}) (*gvar.Var, error) + LTrim func(ctx context.Context, key string, start, stop int64) error + RPop func(ctx context.Context, key string, count ...int) (*gvar.Var, error) + RPopLPush func(ctx context.Context, source, destination string) (*gvar.Var, error) + RPush func(ctx context.Context, key string, values ...interface{}) (int64, error) + RPushX func(ctx context.Context, key string, value interface{}) (int64, error) + type IGroupPubSub interface + PSubscribe func(ctx context.Context, pattern string, patterns ...string) (Conn, []*Subscription, error) + Publish func(ctx context.Context, channel string, message interface{}) (int64, error) + Subscribe func(ctx context.Context, channel string, channels ...string) (Conn, []*Subscription, error) + type IGroupScript interface + Eval func(ctx context.Context, script string, numKeys int64, keys []string, ...) (*gvar.Var, error) + EvalSha func(ctx context.Context, sha1 string, numKeys int64, keys []string, ...) (*gvar.Var, error) + ScriptExists func(ctx context.Context, sha1 string, sha1s ...string) (map[string]bool, error) + ScriptFlush func(ctx context.Context, option ...ScriptFlushOption) error + ScriptKill func(ctx context.Context) error + ScriptLoad func(ctx context.Context, script string) (string, error) + type IGroupSet interface + SAdd func(ctx context.Context, key string, member interface{}, members ...interface{}) (int64, error) + SCard func(ctx context.Context, key string) (int64, error) + SDiff func(ctx context.Context, key string, keys ...string) (gvar.Vars, error) + SDiffStore func(ctx context.Context, destination string, key string, keys ...string) (int64, error) + SInter func(ctx context.Context, key string, keys ...string) (gvar.Vars, error) + SInterStore func(ctx context.Context, destination string, key string, keys ...string) (int64, error) + SIsMember func(ctx context.Context, key string, member interface{}) (int64, error) + SMIsMember func(ctx context.Context, key, member interface{}, members ...interface{}) ([]int, error) + SMembers func(ctx context.Context, key string) (gvar.Vars, error) + SMove func(ctx context.Context, source, destination string, member interface{}) (int64, error) + SPop func(ctx context.Context, key string, count ...int) (*gvar.Var, error) + SRandMember func(ctx context.Context, key string, count ...int) (*gvar.Var, error) + SRem func(ctx context.Context, key string, member interface{}, members ...interface{}) (int64, error) + SUnion func(ctx context.Context, key string, keys ...string) (gvar.Vars, error) + SUnionStore func(ctx context.Context, destination, key string, keys ...string) (int64, error) + type IGroupSortedSet interface + ZAdd func(ctx context.Context, key string, option *ZAddOption, member ZAddMember, ...) (*gvar.Var, error) + ZCard func(ctx context.Context, key string) (int64, error) + ZCount func(ctx context.Context, key string, min, max string) (int64, error) + ZIncrBy func(ctx context.Context, key string, increment float64, member interface{}) (float64, error) + ZLexCount func(ctx context.Context, key, min, max string) (int64, error) + ZRange func(ctx context.Context, key string, start, stop int64, option ...ZRangeOption) (gvar.Vars, error) + ZRank func(ctx context.Context, key string, member interface{}) (int64, error) + ZRem func(ctx context.Context, key string, member interface{}, members ...interface{}) (int64, error) + ZRemRangeByLex func(ctx context.Context, key string, min, max string) (int64, error) + ZRemRangeByRank func(ctx context.Context, key string, start, stop int64) (int64, error) + ZRemRangeByScore func(ctx context.Context, key string, min, max string) (int64, error) + ZRevRange func(ctx context.Context, key string, start, stop int64, option ...ZRevRangeOption) (*gvar.Var, error) + ZRevRank func(ctx context.Context, key string, member interface{}) (int64, error) + ZScore func(ctx context.Context, key string, member interface{}) (float64, error) + type IGroupString interface + Append func(ctx context.Context, key string, value string) (int64, error) + Decr func(ctx context.Context, key string) (int64, error) + DecrBy func(ctx context.Context, key string, decrement int64) (int64, error) + Get func(ctx context.Context, key string) (*gvar.Var, error) + GetDel func(ctx context.Context, key string) (*gvar.Var, error) + GetEX func(ctx context.Context, key string, option ...GetEXOption) (*gvar.Var, error) + GetRange func(ctx context.Context, key string, start, end int64) (string, error) + GetSet func(ctx context.Context, key string, value interface{}) (*gvar.Var, error) + Incr func(ctx context.Context, key string) (int64, error) + IncrBy func(ctx context.Context, key string, increment int64) (int64, error) + IncrByFloat func(ctx context.Context, key string, increment float64) (float64, error) + MGet func(ctx context.Context, keys ...string) (map[string]*gvar.Var, error) + MSet func(ctx context.Context, keyValueMap map[string]interface{}) error + MSetNX func(ctx context.Context, keyValueMap map[string]interface{}) (bool, error) + Set func(ctx context.Context, key string, value interface{}, option ...SetOption) (*gvar.Var, error) + SetEX func(ctx context.Context, key string, value interface{}, ttlInSeconds int64) error + SetNX func(ctx context.Context, key string, value interface{}) (bool, error) + SetRange func(ctx context.Context, key string, offset int64, value string) (int64, error) + StrLen func(ctx context.Context, key string) (int64, error) + type LInsertOp string + const LInsertAfter + const LInsertBefore + type Message struct + Channel string + Pattern string + Payload string + PayloadSlice []string + type Redis struct + func Instance(name ...string) *Redis + func New(config ...*Config) (*Redis, error) + func NewWithAdapter(adapter Adapter) (*Redis, error) + func (r *Redis) Close(ctx context.Context) error + func (r *Redis) Conn(ctx context.Context) (Conn, error) + func (r *Redis) Do(ctx context.Context, command string, args ...interface{}) (*gvar.Var, error) + func (r *Redis) GetAdapter() Adapter + func (r *Redis) MustConn(ctx context.Context) Conn + func (r *Redis) MustDo(ctx context.Context, command string, args ...interface{}) *gvar.Var + func (r *Redis) SetAdapter(adapter Adapter) + type ScanOption struct + Count int + Match string + Type string + func (scanOpt *ScanOption) ToUsedOption() doScanOption + type ScriptFlushOption struct + ASYNC bool + SYNC bool + type SetOption struct + Get bool + NX bool + XX bool + type Subscription struct + Channel string + Count int + Kind string + func (m *Subscription) String() string + type TTLOption struct + EX *int64 + EXAT *int64 + KeepTTL bool + PX *int64 + PXAT *int64 + type ZAddMember struct + Member interface{} + Score float64 + type ZAddOption struct + CH bool + GT bool + INCR bool + LT bool + NX bool + XX bool + type ZRangeOption struct + ByLex bool + ByScore bool + Limit *ZRangeOptionLimit + Rev bool + WithScores bool + type ZRangeOptionLimit struct + Count *int + Offset *int + type ZRevRangeOption struct + WithScores bool