Versions in this module Expand all Collapse all v1 v1.0.7 Sep 1, 2023 v1.0.6 Aug 1, 2023 Changes in this version + const DefaultNotifyPattern + var Debug = base.Debug + var ErrKeyFormat = NewError(`key format error`) + var ErrKeyList = NewError(`key list is empty`) + func NewError(msg string) error + type Conf struct + func NewConf(option ConfOption) (c *Conf, err error) + func (c *Conf) Get(key string) base.JsonParam + func (c *Conf) Range(f func(key string, value base.JsonParam) bool) + func (c *Conf) SetKeyspaceNotify(pattern string) error + type ConfOption struct + KeyList []string + Option Option + Prefix string + SyncIntervalSecond int64 + SyncPageSize int + type GedisError struct + func (ge *GedisError) Error() string + func (ge *GedisError) Is(target error) bool type Pool + GetBytes func(key string) (val []byte, err error) + MGetBytesMap func(keys ...string) (keyValue map[string][]byte, err error) v1.0.5 Jul 20, 2023 v1.0.4 Jul 20, 2023 Changes in this version + var DefaultLocalCache sync.Map type Pool + LevelCache func(localCache *sync.Map, key string, current, timeoutSecond int64, ...) (value []byte, err error) v1.0.3 Jul 19, 2023 Changes in this version + func Get(key string) (value interface{}) + func Range(handler func(key string, pool Pool, group Group) bool) + func Set(key string, value interface{}) + func SetGroup(key string, options ...GroupOption) (err error) + func SetPool(key string, option Option) + func SetPoolByJson(key string, jsonStr string) (err error) type Group + func GetGroup(key string) Group type Option + func DefaultOption() Option type Pool + func GetPool(key string) Pool + func NewPoolWithJson(jsonStr string) (p Pool, err error) v1.0.2 Jul 19, 2023 Changes in this version + var Error = base.Error + func BytesMap(result interface{}, err error) (map[string][]byte, error) + type Handler func() (value []byte, err error) type Item + CreatedAt int64 + UpdatedAt int64 + UpdatedCount int64 + type Log func(msg string, fields ...zap.Field) type Option + IdleTimeoutSecond int + MaxConnLifetimeSecond int type Pool + CacheGetItem func(key string, current, timeoutSecond int64, handler Handler) (item Item, err error) + HGetAllBytes func(key string) (keyValues map[string][]byte, err error) v1.0.1 Jan 2, 2022 v1.0.0 Nov 25, 2021 Changes in this version + const Ok + const Pipeline + const Success + const Transaction + var ErrOptionEmpty = errors.New(`redis option empty`) + var ErrUnKnownSubMsg = errors.New(`unknown pubsub notification`) + var PipeMulti = func() Multi + var ReleaseMulti = func(m Multi) + var TransMulti = func() Multi + func String(reply interface{}, err error) (string, error) + type Cmd struct + type Group interface + Get func(key interface{}) (p Pool, err error) + GetByNumber func(key int64) (p Pool, err error) + Index func(index int) (p Pool, err error) + Range func(handler func(index int, p Pool, hitCount uint64) (handled bool)) + func NewGroup(options ...GroupOption) (g Group, err error) + type GroupOption struct + Option Option + VirtualCount int + type Item struct + CreateAt int64 + ExpireAt int64 + Hit bool + HitCount int64 + MissCount int64 + UpdateAt int64 + Value []byte + type Location struct + Distance string + Hash int64 + Lat float64 + Lng float64 + Member string + func Locations(reply interface{}, err error) ([]Location, error) + type Msg struct + Channel string + Data []byte + Pattern string + type Multi interface + Append func(key string, value interface{}) Multi + BitCount func(key string, args ...interface{}) Multi + CmdList func() []Cmd + Decr func(key string) Multi + DecrBy func(key string, decrement int) Multi + Del func(keys ...interface{}) Multi + Dump func(key string) Multi + Exists func(key interface{}) Multi + Expire func(key interface{}, second int64) Multi + ExpireAt func(key interface{}, unixTime int64) Multi + GeoAdd func(key string, longitude, latitude float64, member interface{}, ...) Multi + GeoDel func(key string, members ...interface{}) Multi + GeoDist func(key string, member1, member2 interface{}, unit string) Multi + GeoHash func(key string, members ...interface{}) Multi + GeoPos func(key string, members ...interface{}) Multi + GeoRadius func(key string, longitude, latitude float64, radius interface{}, unit string, ...) Multi + GeoRadiusByMember func(key string, member interface{}, radius interface{}, unit string, count int, ...) Multi + Get func(key string) Multi + GetBit func(key string, offset int) Multi + GetRange func(key string, start, end int) Multi + GetSet func(key string, value interface{}) Multi + HDel func(key string, fields ...string) Multi + HExists func(key string, field string) Multi + HGet func(key string, field string) Multi + HGetAll func(key string) Multi + HIncrBy func(key string, field string, increment int) Multi + HIncrByFloat func(key string, field string, increment float64) Multi + HKeys func(key string) Multi + HLen func(key string) Multi + HMGet func(key string, fields ...string) Multi + HMSet func(key string, field1 string, value1 interface{}, args ...interface{}) Multi + HMSetMap func(key string, keyValues map[string]interface{}) Multi + HSet func(key string, field string, value interface{}) Multi + HSetNx func(key string, field string, value interface{}) Multi + HVals func(key string) Multi + Incr func(key string) Multi + IncrBy func(key string, increment int) Multi + IncrByFloat func(key string, increment float64) Multi + Keys func(pattern string) Multi + Kind func() uint8 + LIndex func(key string, index int) Multi + LLen func(key string) Multi + LPop func(key string) Multi + LPush func(key string, values ...interface{}) Multi + LPushX func(key string, value interface{}) Multi + LRange func(key string, start, stop int) Multi + LSet func(key string, index int, value interface{}) Multi + LTrim func(key string, start, stop int) Multi + MGet func(keys ...string) Multi + MSet func(key1 string, value1 interface{}, keyValues ...interface{}) Multi + MSetByMap func(keyValues map[string]interface{}) Multi + Move func(key string, db int) Multi + Persist func(key interface{}) Multi + RPop func(key string) Multi + RPush func(key string, values ...interface{}) Multi + RPushX func(key string, value interface{}) Multi + RandomKey func() Multi + ReName func(key string, newKey string) Multi + ReNameNx func(key string, newKey string) Multi + Reset func() + Restore func(key string, pttl int64, serializedValue string) Multi + SAdd func(key string, members ...interface{}) Multi + SCard func(key string) Multi + SDiff func(keys ...interface{}) Multi + SDiffStore func(destinationSetKey string, keys ...string) Multi + SInter func(keys ...interface{}) Multi + SInterStore func(destinationSetKey string, keys ...string) Multi + SIsMember func(key string, member interface{}) Multi + SMembers func(key string) Multi + SMove func(sourceSetKey, destinationSetKey string, member interface{}) Multi + SPop func(key string) Multi + SRandMember func(key string, count int) Multi + SRem func(key string, members ...interface{}) Multi + SUnion func(keys ...interface{}) Multi + SUnionStore func(destinationSetKey string, keys ...string) Multi + Set func(key string, value interface{}, args ...interface{}) Multi + SetBit func(key string, offset int, bit int8) Multi + SetEx func(key string, seconds int, value interface{}) Multi + SetNx func(key string, value interface{}) Multi + SetRange func(key string, offset int, val string) Multi + Ttl func(key interface{}) Multi + Type func(key string) Multi + ZAdd func(key string, score, value interface{}, scoreAndValues ...interface{}) Multi + ZAddMap func(key string, membersMap map[string]interface{}) Multi + ZCard func(key string) Multi + ZCount func(key string, minScore, maxScore interface{}) Multi + ZIncrBy func(key string, increment interface{}, member string) Multi + ZRange func(key string, startIndex, stopIndex int) Multi + ZRangeByScore func(key string, minScore, maxScore interface{}, offset, limit int) Multi + ZRangeByScoreWithScore func(key string, minScore, maxScore interface{}, offset, limit int) Multi + ZRangeWithScore func(key string, startIndex, stopIndex int) Multi + ZRank func(key, member string) Multi + ZRem func(key string, members ...interface{}) Multi + ZRemRangeByRank func(key string, startIndex, stopIndex int) Multi + ZRevRange func(key string, startIndex, stopIndex int) Multi + ZRevRangeByScore func(key string, maxScore, minScore interface{}, offset, limit int) Multi + ZRevRangeByScoreWithScore func(key string, maxScore, minScore interface{}, offset, limit int) Multi + ZRevRangeWithScore func(key string, startIndex, stopIndex int) Multi + ZRevRank func(key, member string) Multi + ZScore func(key, member string) Multi + func NewMulti(kind uint8) Multi + type Option struct + Auth string + ConnectTimeout int + Db uint8 + Host string + Index int + MaxActive int + MaxConnLifetime int + MaxIdle int + Port int + ReadTimeout int + Wait bool + WriteTimeout int + type Pong struct + Data string + type Pool interface + Acquire func(key string, timeoutSecond int) (token int64, err error) + ActiveCount func() (num int) + Append func(key string, value interface{}) (strLength int, err error) + BitCount func(key string, args ...interface{}) (num int, err error) + CacheGet func(key string, timeoutSecond int64, handler func() []byte) (item Item, err error) + CacheRemove func(key string) (ok bool, err error) + ClientList func() (clients []string, err error) + Close func() (err error) + ConfigGet func(pattern string) (conf map[string]string, err error) + ConfigSet func(param string, value interface{}) (ok bool, err error) + DayLimitByTime func(key string, limit int, reqNum int) (ok bool, err error) + Decr func(key string) (val int64, err error) + DecrBy func(key string, decrement int) (val int64, err error) + Del func(keys ...interface{}) (delNum int, err error) + Do func(cmd string, args ...interface{}) (reply interface{}, err error) + Dump func(key string) (serializedValue string, err error) + EvalOrSha func(script string, keyCount int, keysAndArgs ...interface{}) (reply interface{}, err error) + EvalOrSha4Int64 func(script string, keyCount int, keysAndArgs ...interface{}) (res int64, err error) + EvalOrSha4String func(script string, keyCount int, keysAndArgs ...interface{}) (res string, err error) + Exec func(multi Multi) (values []interface{}, err error) + Exists func(key interface{}) (exists bool, err error) + Expire func(key interface{}, second int64) (success int, err error) + ExpireAt func(key interface{}, unixTime int64) (success int, err error) + GeoAdd func(key string, longitude, latitude float64, member interface{}, ...) (createNum int, err error) + GeoDel func(key string, members ...interface{}) (removeNum int, err error) + GeoDist func(key string, member1, member2 interface{}, unit string) (distance string, err error) + GeoHash func(key string, members ...interface{}) (hashList []string, err error) + GeoPos func(key string, members ...interface{}) (positionList []Position, err error) + GeoRadius func(key string, longitude, latitude float64, radius interface{}, unit string, ...) (locationList []Location, err error) + GeoRadiusByMember func(key string, member interface{}, radius interface{}, unit string, count int, ...) (locationList []Location, err error) + Get func(key string) (val string, err error) + GetBit func(key string, offset int) (bit int, err error) + GetRange func(key string, start, end int) (val string, err error) + GetSet func(key string, value interface{}) (oldValue string, err error) + GetToken func(key string, current int64, capacity, rate, reqNum, keyTimeoutSecond int) (ok bool, err error) + HDel func(key string, fields ...string) (delNum int, err error) + HExists func(key string, field string) (exists bool, err error) + HGet func(key string, field string) (value string, err error) + HGetAll func(key string) (keyValues map[string]string, err error) + HIncrBy func(key string, field string, increment int) (val int64, err error) + HIncrByFloat func(key string, field string, increment float64) (val float64, err error) + HKeys func(key string) (fields []string, err error) + HLen func(key string) (length int, err error) + HMGet func(key string, fields ...string) (values []string, err error) + HMGetMap func(key string, fields ...string) (keyValues map[string]string, err error) + HMSet func(key string, field1 string, value1 interface{}, args ...interface{}) (ok bool, err error) + HMSetMap func(key string, keyValues map[string]interface{}) (ok bool, err error) + HSet func(key string, field string, value interface{}) (isNew int, err error) + HSetNx func(key string, field string, value interface{}) (ok int, err error) + HVals func(key string) (values []string, err error) + HourLimitByTime func(key string, limit int, reqNum int) (ok bool, err error) + IdleCount func() (num int) + Incr func(key string) (val int64, err error) + IncrBy func(key string, increment int) (val int64, err error) + IncrByFloat func(key string, increment float64) (val float64, err error) + Keys func(pattern string) (keys []string, err error) + LIndex func(key string, index int) (value string, err error) + LLen func(key string) (listLength int, err error) + LPop func(key string) (value string, err error) + LPush func(key string, values ...interface{}) (listLength int, err error) + LPushX func(key string, value interface{}) (listLength int, err error) + LRange func(key string, start, stop int) (values []string, err error) + LSet func(key string, index int, value interface{}) (ok bool, err error) + LTrim func(key string, start, stop int) (ok bool, err error) + MGet func(keys ...string) (values []string, err error) + MGetMap func(keys ...string) (keyValue map[string]string, err error) + MSet func(key1 string, value1 interface{}, keyValues ...interface{}) (ok bool, err error) + MSetByMap func(keyValues map[string]interface{}) (ok bool, err error) + MinuteLimitByTime func(key string, limit int, reqNum int) (ok bool, err error) + Move func(key string, db int) (success int, err error) + Persist func(key interface{}) (success int, err error) + PubSubChannels func(pattern string) (channels []string, err error) + Publish func(channel string, msg string) (receiveNum int, err error) + RPop func(key string) (value string, err error) + RPush func(key string, values ...interface{}) (listLength int, err error) + RPushX func(key string, value interface{}) (listLength int, err error) + RandomKey func() (key string, err error) + ReName func(key string, newKey string) (ok bool, err error) + ReNameNx func(key string, newKey string) (success int, err error) + Release func(key string, token int64) (ok bool, err error) + Restore func(key string, pttl int64, serializedValue string) (ok bool, err error) + SAdd func(key string, members ...interface{}) (addNum int, err error) + SCard func(key string) (count int, err error) + SDiff func(keys ...interface{}) (members []string, err error) + SDiffStore func(destinationSetKey string, keys ...string) (memberCount int, err error) + SInter func(keys ...interface{}) (members []string, err error) + SInterStore func(destinationSetKey string, keys ...string) (memberCount int, err error) + SIsMember func(key string, member interface{}) (exists bool, err error) + SMembers func(key string) (members []string, err error) + SMove func(sourceSetKey, destinationSetKey string, member interface{}) (success int, err error) + SPop func(key string) (member string, err error) + SRandMember func(key string, count int) (members []string, err error) + SRem func(key string, members ...interface{}) (removeNum int, err error) + SScan func(key string, cursor int, match string, count int) (newCursor int, keys []string, err error) + SUnion func(keys ...interface{}) (members []string, err error) + SUnionStore func(destinationSetKey string, keys ...string) (memberCount int, err error) + Scan func(cursor int, match string, count int) (newCursor int, keys []string, err error) + SecondLimitByTime func(key string, limit int, reqNum int) (ok bool, err error) + SecondLimitByToken func(key string, limit int, reqNum int) (ok bool, err error) + Set func(key string, value interface{}, args ...interface{}) (ok bool, err error) + SetBit func(key string, offset int, bit int8) (oldBit int, err error) + SetEx func(key string, seconds int, value interface{}) (ok bool, err error) + SetNx func(key string, value interface{}) (ok int, err error) + SetRange func(key string, offset int, val string) (strLength int, err error) + Stats func() redigo.PoolStats + Ttl func(key interface{}) (second int64, err error) + Type func(key string) (t string, err error) + ZAdd func(key string, score, value interface{}, scoreAndValues ...interface{}) (createNum int, err error) + ZAddMap func(key string, membersMap map[string]interface{}) (createNum int, err error) + ZCard func(key string) (count int, err error) + ZCount func(key string, minScore, maxScore interface{}) (count int, err error) + ZIncrBy func(key string, increment interface{}, member string) (newScore string, err error) + ZRange func(key string, startIndex, stopIndex int) (members []string, err error) + ZRangeByScore func(key string, minScore, maxScore interface{}, offset, limit int) (members []string, err error) + ZRangeByScoreWithScore func(key string, minScore, maxScore interface{}, offset, limit int) (members map[string]string, err error) + ZRangeWithScore func(key string, startIndex, stopIndex int) (members map[string]string, err error) + ZRank func(key, member string) (rankIndex int, err error) + ZRem func(key string, members ...interface{}) (removeNum int, err error) + ZRemRangeByRank func(key string, startIndex, stopIndex int) (removeNum int, err error) + ZRevRange func(key string, startIndex, stopIndex int) (members []string, err error) + ZRevRangeByScore func(key string, maxScore, minScore interface{}, offset, limit int) (members []string, err error) + ZRevRangeByScoreWithScore func(key string, maxScore, minScore interface{}, offset, limit int) (members map[string]string, err error) + ZRevRangeWithScore func(key string, startIndex, stopIndex int) (members map[string]string, err error) + ZRevRank func(key, member string) (rankIndex int, err error) + ZScan func(key string, cursor int, match string, count int) (newCursor int, keys []string, err error) + ZScore func(key, member string) (score string, err error) + func NewPool(option Option) (p Pool) + type Position struct + Lat float64 + Lng float64 + func Positions(reply interface{}, err error) ([]Position, error) + type SubConn interface + Close func() error + PSubscribe func(channels ...interface{}) error + PSubscribeChannel func(ctx context.Context, size int, channels ...interface{}) (ch chan interface{}, err error) + PUnsubscribe func(channels ...interface{}) error + Ping func(data string) error + Receive func() interface{} + ReceiveWithTimeout func(timeout time.Duration) interface{} + Subscribe func(channels ...interface{}) error + SubscribeChannel func(ctx context.Context, size int, channels ...interface{}) (ch chan interface{}, err error) + Unsubscribe func(channels ...interface{}) error + func NewSubConn(option Option) (SubConn, error) + type Subscription struct + Channel string + Count int + Kind string