Documentation ¶
Index ¶
- Constants
- Variables
- func Decode(encoding string, b []byte, v interface{}) error
- func Encode(encoding string, v interface{}) (interface{}, error)
- func GetPool(name string) *redis.Pool
- func GetPoolConn(name string) redis.Conn
- func InstallExt(ctrlName string, mc IMCGeter, confs ...*Config)
- func IsErrNil(err error) bool
- func NewMutex(dbName, key string) *redsync.Mutex
- func RegCodec(name string, codecer Codecer)
- type Bit
- type Codecer
- type Config
- type Hash
- func (k Hash) HDel(fileds interface{}) *Reply
- func (k Hash) HExists(filed interface{}) *Reply
- func (k Hash) HGet(filed interface{}) *Reply
- func (k Hash) HGetAll() *Reply
- func (k Hash) HIncrBy(filed interface{}, increment interface{}) *Reply
- func (k Hash) HIncrByFloat(filed interface{}, increment float64) *Reply
- func (k Hash) HKeys() *Reply
- func (k Hash) HLen() *Reply
- func (k Hash) HMGet(fileds interface{}) *Reply
- func (k Hash) HMSetMap(mp map[interface{}]interface{}) *Reply
- func (k Hash) HMSetStruct(obj interface{}) *Reply
- func (k Hash) HSet(filed, value interface{}, exist ...bool) *Reply
- func (k Hash) HVals() *Reply
- type IMCGeter
- type Key
- func (k Key) Del(keys ...string) *Reply
- func (k Key) Dump() *Reply
- func (k Key) Exists() *Reply
- func (k Key) Expire(seconds int64) *Reply
- func (k Key) ExpireAt(timestamp int64) *Reply
- func (k Key) Keys() *Reply
- func (k Key) Move(db int64) *Reply
- func (k Key) PTTL() *Reply
- func (k Key) Persist() *Reply
- func (k Key) PersistAt(milliSeconds int64) *Reply
- func (k Key) RandomKey() *Reply
- func (k Key) Rename(newKey string) *Reply
- func (k Key) RenameNX(newKey string) *Reply
- func (k Key) Restore(ttlMS, serializedValue interface{}) *Reply
- func (k Key) Select(db int64) *Reply
- func (k Key) TTL() *Reply
- func (k Key) Type() *Reply
- type List
- func (k List) BLpop(timeout interface{}) *Reply
- func (k List) BRpop(timeout interface{}) *Reply
- func (k List) BRpoplpush(key, source, destination string, timeout interface{}) *Reply
- func (k List) LIndex(index interface{}) *Reply
- func (k List) LInsert(position, pivot, value string) *Reply
- func (k List) LPop() *Reply
- func (k List) LPush(value interface{}) *Reply
- func (k List) LPushx(value interface{}) *Reply
- func (k List) LRange(start, stop interface{}) *Reply
- func (k List) LRem(count, value interface{}) *Reply
- func (k List) LSet(index, value interface{}) *Reply
- func (k List) LTrim(start, stop interface{}) *Reply
- func (k List) RPop() *Reply
- func (k List) RPoplpush(key, source, destination string) *Reply
- func (k List) RPush(value interface{}) *Reply
- func (k List) RPushx(value interface{}) *Reply
- type Redis
- type Reply
- func (r *Reply) Bool() (bool, error)
- func (r *Reply) ByteSlices() ([][]byte, error)
- func (r *Reply) Bytes() ([]byte, error)
- func (r *Reply) Error() error
- func (r *Reply) Float64s() ([]float64, error)
- func (r *Reply) Int() (int, error)
- func (r *Reply) Int64() (int64, error)
- func (r *Reply) Int64Map() (map[string]int64, error)
- func (r *Reply) Int64s() ([]int64, error)
- func (r *Reply) IntMap() (map[string]int, error)
- func (r *Reply) Ints() ([]int, error)
- func (r *Reply) Positions() ([]*[2]float64, error)
- func (r *Reply) Result() (interface{}, error)
- func (r *Reply) ScanStruct(pObj interface{}) error
- func (r *Reply) String() (string, error)
- func (r *Reply) StringMap() (map[string]string, error)
- func (r *Reply) Strings() ([]string, error)
- func (r *Reply) Uint64() (uint64, error)
- func (r *Reply) Unmarshal(v interface{}) error
- func (r *Reply) Values() ([]interface{}, error)
- type Set
- func (k Set) SAdd(fileds []interface{}) *Reply
- func (k Set) SCard() *Reply
- func (k Set) SDiff(keys []string) *Reply
- func (k Set) SDiffStore(destinationKey string, keys []string) *Reply
- func (k Set) SInter(keys []string) *Reply
- func (k Set) SInterStore(destinationKey string, keys []string) *Reply
- func (k Set) SMembers() *Reply
- func (k Set) SMove(sourceKey, destinationKey string, member interface{}) *Reply
- func (k Set) SPop() *Reply
- func (k Set) SRandMember(count ...int64) *Reply
- func (k Set) SRem(members []interface{}) *Reply
- func (k Set) SUnion(keys []string) *Reply
- func (k Set) SUnionStore(destinationKey string, keys []string) *Reply
- func (k Set) SisMember(member interface{}) *Reply
- type String
- func (k String) Decr() *Reply
- func (k String) DecrBy(increment int64) *Reply
- func (k String) Get() *Reply
- func (k String) GetRange(start, end int64) *Reply
- func (k String) GetSet(value interface{}) *Reply
- func (k String) Incr() *Reply
- func (k String) IncrBy(increment int64) *Reply
- func (k String) IncrByFloat(increment float64) *Reply
- func (k String) LuaIncrBy(amount int) *Reply
- func (k String) MGet(keys []string) *Reply
- func (k String) MSet(kv map[string]interface{}) *Reply
- func (k String) MSetNx(kv map[string]interface{}) *Reply
- func (k String) PSetEX(value interface{}, milliseconds int64) *Reply
- func (k String) Set(value interface{}, expire ...int64) *Reply
- func (k String) SetEX(value interface{}, seconds int64) *Reply
- func (k String) SetNX(value interface{}) *Reply
- func (k String) SetRange(value interface{}, offset int64) *Reply
- type Zset
- func (k Zset) ZAdd(mp map[interface{}]interface{}) *Reply
- func (k Zset) ZCard() *Reply
- func (k Zset) ZCount(min, max interface{}) *Reply
- func (k Zset) ZEank(member interface{}) *Reply
- func (k Zset) ZRange(start, stop interface{}, withScore ...bool) *Reply
- func (k Zset) ZRevrange(start, stop interface{}, withScore ...bool) *Reply
- func (k Zset) ZScore(member interface{}) *Reply
- func (k Zset) ZUncrBy(increment, member interface{}) *Reply
Constants ¶
const ( DEF_REDIS_IS_WAIT = true // Redis 默认负荷>MaxActive时等待 DEF_IDLE_TIMEOVER = 1 * time.Minute // 空闲多久回收 DEF_CODING_JSON = "json" // json方式的编解码器 DEF_CODING_MSGPACK = "msgpack" // msgpack方式的编解码器 )
------------------------------------------------------------------------------ ====================================常量定义===================================== ------------------------------------------------------------------------------
Variables ¶
Functions ¶
Types ¶
type Codecer ¶
type Codecer struct { Encoder func(v interface{}) ([]byte, error) Decoder func(data []byte, v interface{}) error }
=> 编码器接口
type Config ¶
type Config struct { Name string `json:"name"` Addr string `json:"addr"` DbIdx int `json:"dbIdx"` Password string `json:"password"` MaxIdle int `json:"maxIdle"` MaxActive int `json:"maxActive"` Wait bool `json:"wait"` } //
=> Redis配置
type Hash ¶
type Hash struct{ Key }
func (Hash) HIncrByFloat ¶
Hash.HIncrByFloat 为指定字段值增加浮点数
func (Hash) HMSetStruct ¶
Hash.HMSetStruct 设置多个字段及值 [struct]
type IMCGeter ¶
type IMCGeter interface { cto.ICtrlHandler // 获取基类配置 HandleRedis() *Redis }
=> ETCD管理器接口
type List ¶
type List struct{ Key }
****************************************************************************** Copyright:cloud Author:cloudapex@126.com Version:1.0 Date:2020-05-13 Description: List数据结构 ******************************************************************************
func (List) BRpoplpush ¶
List.BRpoplpush 阻塞并弹出尾元素,将弹出元素插入另一列表的开头
func (List) LInsert ¶
List.LInsert 将元素插入指定位置position:BEFORE|AFTER,当 pivot 不存在于列表 key 时,不执行任何操作。当 key 不存在时, key 被视为空列表,不执行任何操作。
func (List) LRem ¶
List.LRem 移除元素,count = 0 : 移除表中所有与 value 相等的值,count!=0,移除与 value 相等的元素,数量为 count的绝对值
type Redis ¶
type Redis struct { cto.ControlBase // contains filtered or unexported fields }
=>redis client control
func (*Redis) HandleInit ¶
func (this *Redis) HandleInit()
func (*Redis) HandleTerm ¶
func (this *Redis) HandleTerm()
type Reply ¶
type Reply struct { Coding string // contains filtered or unexported fields }
--------
func (*Reply) ByteSlices ¶
func (*Reply) ScanStruct ¶
type Set ¶
type Set struct{ Key }
func (Set) SDiffStore ¶
Set.SDiffStore 将一或多个集合的差集保存至另一集合(destinationKey)
func (Set) SInterStore ¶
Set.SInterStore 将keys的集合的并集 写入到 destinationKey中
func (Set) SRandMember ¶
Set.SRandMember 随机返回一个或多个元素
func (Set) SUnionStore ¶
Set.SUnionStore 将 keys 的集合的并集 写入到 destinationKey 中
type String ¶
type String struct{ Key }
func (String) IncrByFloat ¶
String.IncrByFloat 增加一个浮点值
type Zset ¶
type Zset struct{ Key }
****************************************************************************** Copyright:cloud Author:cloudapex@126.com Version:1.0 Date:2020-05-13 Description: Zset数据结构 ******************************************************************************