Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrKeyNotFound = errors.New("key not found")
ErrKeyNotFound returned when given key not found.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used for basic operations such as set and get.
func NewClient ¶
NewClient instantiates a client with a given address in a form of host:port and maxIdleConn conn pool. Max idle connection specifies the max number of reused connections and should be greater than zero.
func (*Client) Get ¶
Get returns the value associated with the key. If the context contains timeout, a deadline for the connection will be used. It is up to the client to set the timeout. Returns ErrKeyNotFound for non-existing key.
func (*Client) Set ¶
Set sets value associated with a key. If the context contains timeout, a deadline for the connection will be used. It is up to the client to set the timeout. Returns an error in case NOT_STORED response received from the server or if any other error occurred such as connection error, etc.
func (*Client) SetProfiler ¶
SetProfiler sets a profiler to measure network io read/write times.
type FuncProfiler ¶
type FuncProfiler struct {
// contains filtered or unexported fields
}
func NewFuncProfiler ¶
func NewFuncProfiler(f func(string, time.Duration)) *FuncProfiler
NewFuncProfiler instantiates profiler. func f is exposed to the client of this method to customize reported metrics handling.