Documentation
¶
Index ¶
- Constants
- type Adapter
- func (a *Adapter) Add(key string, value interface{}, expire ...time.Duration) bool
- func (a *Adapter) Construct(componentId ...string)
- func (a *Adapter) Del(key string) bool
- func (a *Adapter) Do(cmd string, args ...interface{}) interface{}
- func (a *Adapter) Exists(key string) bool
- func (a *Adapter) Get(key string) *pgo.Value
- func (a *Adapter) GetClient() *Client
- func (a *Adapter) Incr(key string, delta int) int
- func (a *Adapter) MAdd(items map[string]interface{}, expire ...time.Duration) bool
- func (a *Adapter) MDel(keys []string) bool
- func (a *Adapter) MGet(keys []string) map[string]*pgo.Value
- func (a *Adapter) MSet(items map[string]interface{}, expire ...time.Duration) bool
- func (a *Adapter) Set(key string, value interface{}, expire ...time.Duration) bool
- func (a *Adapter) SetPanicRecover(v bool)
- type Client
- func (c *Client) Add(key string, value interface{}, expire ...time.Duration) bool
- func (c *Client) Del(key string) bool
- func (c *Client) Do(cmd string, args ...interface{}) interface{}
- func (c *Client) Exists(key string) bool
- func (c *Client) Get(key string) *pgo.Value
- func (c *Client) Incr(key string, delta int) int
- func (c *Client) MAdd(items map[string]interface{}, expire ...time.Duration) bool
- func (c *Client) MDel(keys []string) bool
- func (c *Client) MGet(keys []string) map[string]*pgo.Value
- func (c *Client) MSet(items map[string]interface{}, expire ...time.Duration) bool
- func (c *Client) Set(key string, value interface{}, expire ...time.Duration) bool
- type ClusterPool
- type Conn
- type IPool
- type MasterSlavePool
- type Pool
- func (p *Pool) AddrNewKeys(cmd string, v interface{}) (map[string][]string, map[string]string)
- func (p *Pool) BuildKey(key string) string
- func (p *Pool) Construct()
- func (p *Pool) GetAddrByKey(cmd, key string, prevDft ...string) string
- func (p *Pool) GetConnByAddr(addr string) *Conn
- func (p *Pool) GetConnByKey(cmd, key string) *Conn
- func (p *Pool) GetServers() (servers []string)
- func (p *Pool) Init()
- func (p *Pool) RunAddrFunc(addr string, keys []string, wg *sync.WaitGroup, f func(*Conn, []string))
- func (p *Pool) SetDb(db int)
- func (p *Pool) SetMaxIdleConn(v int)
- func (p *Pool) SetMaxIdleTime(v string)
- func (p *Pool) SetMod(v string)
- func (p *Pool) SetNetTimeout(v string)
- func (p *Pool) SetPassword(password string)
- func (p *Pool) SetPrefix(prefix string)
- func (p *Pool) SetProbeInterval(v string)
- func (p *Pool) SetServers(v []interface{})
Constants ¶
View Source
const ( AdapterClass = "@pgo/Client/Redis/Adapter" ModCluster = "cluster" ModMasterSlave = "masterSlave" PgoMasterSlaveCheckPrefix = "pgo_master_slave_check_" NodeActionAdd = "add" NodeActionDel = "del" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
Adapter of Redis Client, add context support. usage: redis := this.GetObject(Redis.AdapterClass).(*Redis.Adapter)
func (*Adapter) Do ¶ added in v0.1.2
支持的命令请查阅:Redis.allRedisCmd args = [0:"key"] Example: redis := t.GetObject(Redis.AdapterClass).(*Redis.Adapter) retI := redis.Do("SADD","myTest", "test1") ret := retI.(int) fmt.Println(ret) = 1 retList :=redis.Do("SMEMBERS","myTest") retListI,_:=ret.([]interface{})
for _,v:=range retListI{ vv :=pgo.NewValue(v) // 写入的时候有pgo.Encode(),如果存入的是结构体或slice map 需要decode,其他类型直接断言类型 fmt.Println(vv.String()) // test1 }
func (*Adapter) SetPanicRecover ¶
type Client ¶
type Client struct {
Pool
}
Redis Client component, require redis-server 2.6.12+ configuration: redis:
class: "@pgo/Client/Redis/Client" prefix: "pgo_" password: "" db: 0 maxIdleConn: 10 maxIdleTime: "60s" netTimeout: "1s" probInterval: "0s" mod:"cluster" servers: - "127.0.0.1:6379" - "127.0.0.1:6380"
type ClusterPool ¶ added in v0.1.3
type ClusterPool struct {
// contains filtered or unexported fields
}
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) CheckActive ¶
type MasterSlavePool ¶ added in v0.1.3
type MasterSlavePool struct {
// contains filtered or unexported fields
}
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) AddrNewKeys ¶
func (*Pool) GetAddrByKey ¶
get redis address/node prevDft 一般用于master-slave mset mget mdel
func (*Pool) GetConnByAddr ¶
func (*Pool) GetConnByKey ¶
func (*Pool) GetServers ¶
func (*Pool) RunAddrFunc ¶
func (*Pool) SetMaxIdleConn ¶
func (*Pool) SetMaxIdleTime ¶
func (*Pool) SetNetTimeout ¶
func (*Pool) SetPassword ¶
func (*Pool) SetProbeInterval ¶
func (*Pool) SetServers ¶
func (p *Pool) SetServers(v []interface{})
Click to show internal directories.
Click to hide internal directories.