Documentation
¶
Index ¶
- Variables
- type Client
- func (cl *Client) Add(noreply bool, items ...*Item) (failedKeys []string, err error)
- func (cl *Client) Append(noreply bool, items ...*Item) (failedKeys []string, err error)
- func (cl *Client) Cas(noreply bool, items ...*Item) (failedKeys []string, err error)
- func (cl *Client) Close() error
- func (cl *Client) Delete(noreply bool, keys ...string) (failedKeys []string, err error)
- func (cl *Client) FlushAll() error
- func (cl *Client) Gat(exp int64, keys ...string) (results []*Item, err error)
- func (cl *Client) GatOrSet(key string, exp int64, cb func(key string) (*Item, error)) (*Item, error)
- func (cl *Client) GatOrSetMulti(keys []string, exp int64, cb func(keys []string) ([]*Item, error)) ([]*Item, error)
- func (cl *Client) Gats(exp int64, keys ...string) (results []*Item, err error)
- func (cl *Client) Get(keys ...string) (results []*Item, err error)
- func (cl *Client) GetOrSet(key string, cb func(key string) (*Item, error)) (*Item, error)
- func (cl *Client) GetOrSetMulti(keys []string, cb func(keys []string) ([]*Item, error)) ([]*Item, error)
- func (cl *Client) Gets(keys ...string) (results []*Item, err error)
- func (cl *Client) Prepend(noreply bool, items ...*Item) (failedKeys []string, err error)
- func (cl *Client) Replace(noreply bool, items ...*Item) (failedKeys []string, err error)
- func (cl *Client) Set(noreply bool, items ...*Item) (failedKeys []string, err error)
- func (cl *Client) SetConnMaxLifetime(d time.Duration)
- func (cl *Client) SetConnMaxOpen(maxOpen int)
- func (cl *Client) SetConnectTimeout(timeout time.Duration)
- func (cl *Client) SetFailover(failover bool)
- func (cl *Client) SetKeepAlivePeriod(period time.Duration)
- func (cl *Client) SetLogger(logf func(format string, params ...interface{}))
- func (cl *Client) SetMaxErrorCount(count int64)
- func (cl *Client) SetPollTimeout(timeout time.Duration)
- func (cl *Client) SetTryReconnectPeriod(period time.Duration)
- func (cl *Client) Stats(argument string) (resultMap map[string][]byte, err error)
- func (cl *Client) Touch(key string, exp int64, noreply bool) error
- type Item
- type Server
- type Servers
Constants ¶
This section is empty.
Variables ¶
var ( ErrNonexistentCommand = errors.New("nonexiststent command error") ErrClient = errors.New("client error") ErrServer = errors.New("server error") ErrOverMaxKeyLength = errors.New("key's length is too long") ErrCanceldByContext = errors.New("canceled by context") )
errors
var ( ErrMemcachedClosed = errors.New("memcached is closed") ErrDeadNode = errors.New("dead node") ErrConnect = errors.New("connect error") ErrBadConn = errors.New("bad conn") ErrNotFound = errors.New("not found") )
Error
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.5.0
type Client struct {
// contains filtered or unexported fields
}
Client is the client of go-memcached.
func (*Client) Append ¶ added in v1.5.0
Append appends the value after the last bytes in an existing item.
func (*Client) Cas ¶ added in v1.5.0
Cas stores the value only if no one else has updated the data since you read it last.
func (*Client) Gat ¶ added in v1.5.0
Gat is used to fetch items and update the expiration time of an existing items.
func (*Client) GatOrSet ¶ added in v1.5.0
func (cl *Client) GatOrSet(key string, exp int64, cb func(key string) (*Item, error)) (*Item, error)
GatOrSet gets from memcached via `gat`, and if no hit, Set value gotten by callback, and return the value
func (*Client) GatOrSetMulti ¶ added in v1.5.0
func (cl *Client) GatOrSetMulti(keys []string, exp int64, cb func(keys []string) ([]*Item, error)) ([]*Item, error)
GatOrSetMulti gets from memcached via `gat`, and if no hit, Set value gotten by callback, and return the value
func (*Client) Gats ¶ added in v1.5.0
Gats is used to fetch items and update the expiration time of an existing items.
func (*Client) GetOrSet ¶ added in v1.5.0
GetOrSet gets from memcached, and if no hit, Set value gotten by callback, and return the value
func (*Client) GetOrSetMulti ¶ added in v1.5.0
func (cl *Client) GetOrSetMulti(keys []string, cb func(keys []string) ([]*Item, error)) ([]*Item, error)
GetOrSetMulti gets from memcached, and if no hit, Set value gotten by callback, and return the value
func (*Client) Gets ¶ added in v1.5.0
Gets returns cached data for given keys, it is an alternative Get api for using with CAS. Gets returns a CAS identifier with the item. If the item's CAS value has changed since you Gets'ed it, it will not be stored.
func (*Client) Replace ¶ added in v1.5.0
Replace replaces the value, only if the value already exists, for the specified cache key.
func (*Client) SetConnMaxLifetime ¶ added in v1.5.0
SetConnMaxLifetime sets the maximum amount of time a connection may be reused.
Expired connections may be closed lazily before reuse.
If d <= 0, connections are reused forever.
func (*Client) SetConnMaxOpen ¶ added in v1.5.0
SetConnMaxOpen sets the maximum amount of opening connections.
func (*Client) SetConnectTimeout ¶ added in v1.5.0
SetConnectTimeout sets the timeout of connect to memcached server.
func (*Client) SetFailover ¶ added in v1.5.0
SetFailover is used to specify whether to use the failover option.
func (*Client) SetKeepAlivePeriod ¶ added in v1.5.0
SetKeepAlivePeriod sets the period of keep alive.
func (*Client) SetMaxErrorCount ¶ added in v1.5.0
SetMaxErrorCount sets the max of error count to close the connection pool.
func (*Client) SetPollTimeout ¶ added in v1.5.0
SetPollTimeout sets the timeout of polling from memcached server.
func (*Client) SetTryReconnectPeriod ¶ added in v1.5.0
SetTryReconnectPeriod sets the period of trying reconnect.