Documentation
¶
Index ¶
- Constants
- func New(config map[string]interface{}) (interface{}, error)
- type Client
- func (c *Client) Add(key string, v interface{}, expire ...time.Duration) (bool, error)
- func (c *Client) Del(key string) (bool, error)
- func (c *Client) Exists(key string) (bool, error)
- func (c *Client) Get(key string) (*value.Value, error)
- func (c *Client) Incr(key string, delta int) (int, error)
- func (c *Client) MAdd(items map[string]interface{}, expire ...time.Duration) (bool, error)
- func (c *Client) MDel(keys []string) (bool, error)
- func (c *Client) MGet(keys []string) (map[string]*value.Value, error)
- func (c *Client) MSet(items map[string]interface{}, expire ...time.Duration) (bool, error)
- func (c *Client) MultiRetrieve(cmd string, keys []string) ([]*Item, error)
- func (c *Client) MultiStore(cmd string, items []*Item, expires ...time.Duration) (bool, error)
- func (c *Client) Retrieve(cmd, key string) (*Item, error)
- func (c *Client) Set(key string, v interface{}, expire ...time.Duration) (bool, error)
- func (c *Client) Store(cmd string, item *Item, expires ...time.Duration) (bool, error)
- type Conn
- func (c *Conn) CheckActive() (bool, error)
- func (c *Conn) Close(force bool)
- func (c *Conn) Delete(key string) (bool, error)
- func (c *Conn) ExtendDeadLine(deadLine ...time.Duration) bool
- func (c *Conn) FlushAll() (bool, error)
- func (c *Conn) Increment(key string, delta int) (int, error)
- func (c *Conn) Retrieve(cmd string, keys ...string) (items []*Item, err error)
- func (c *Conn) Stats(args ...string) (map[string]string, error)
- func (c *Conn) Store(cmd string, item *Item, expire int) (bool, error)
- func (c *Conn) Touch(key string, expire int) (bool, error)
- func (c *Conn) Version() (string, error)
- type Item
- type Pool
- func (p *Pool) AddrNewKeys(v interface{}) (map[string][]string, map[string]string, error)
- func (p *Pool) BuildKey(key string) string
- func (p *Pool) GetAddrByKey(key string) string
- func (p *Pool) GetConnByAddr(addr string) (conn *Conn, err error)
- func (p *Pool) GetConnByKey(key string) (*Conn, error)
- 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)) error
- func (p *Pool) SetMaxIdleConn(v int)
- func (p *Pool) SetMaxIdleTime(v string) error
- func (p *Pool) SetNetTimeout(v string) error
- func (p *Pool) SetPrefix(prefix string)
- func (p *Pool) SetProbeInterval(v string) error
- func (p *Pool) SetServers(v []interface{})
Constants ¶
const ( AdapterClass = "@pgo/Client/Memcache/Adapter" CmdCas = "cas" CmdAdd = "add" CmdSet = "set" CmdReplace = "replace" CmdAppend = "append" CmdPrepend = "prepend" CmdGet = "get" CmdGets = "gets" CmdDelete = "delete" CmdIncr = "incr" CmdDecr = "decr" CmdTouch = "touch" CmdStats = "stats" CmdFlushAll = "flush_all" CmdVersion = "version" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
Pool
}
func (*Client) MultiRetrieve ¶
func (*Client) MultiStore ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) CheckActive ¶
func (*Conn) Increment ¶
execute increment/decrement command, negative delta for decrement, otherwise for increment, if key not found, treat the data as zero, if the data is not uint64 representation, function panic. if decrease data below 0, new data will be 0.
func (*Conn) Retrieve ¶
execute retrieve command, cmd is get or gets, item retrieved by gets cmd has a unique uint64 value, result expects zero or more items, if some of the keys not exists or expired, then corresponding item do not present in the result
func (*Conn) Stats ¶
execute stats command if args is empty, all statistics will be returned, otherwise specified field will be returned
func (*Conn) Store ¶
execute store command, cmd is set, add, replace, append, prepend or cas, expire is expiration time, either unix timestamp or offset in seconds from now, 0 means never expires, negative value means immediately expired return true if succeed, otherwise false
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) AddrNewKeys ¶
func (*Pool) GetAddrByKey ¶
func (*Pool) GetServers ¶
func (*Pool) RunAddrFunc ¶
func (*Pool) SetMaxIdleConn ¶
func (*Pool) SetMaxIdleTime ¶
func (*Pool) SetNetTimeout ¶
func (*Pool) SetProbeInterval ¶
func (*Pool) SetServers ¶
func (p *Pool) SetServers(v []interface{})