Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) Add(item *Item) error
- func (c *Client) Append(item *Item) error
- func (c *Client) Close() error
- func (c *Client) CompareAndSwap(item *Item) error
- func (c *Client) Decr(key string, delta uint64) (uint64, error)
- func (c *Client) Delete(key string) error
- func (c *Client) Get(key string) (*Item, error)
- func (c *Client) Gets(key string) (*Item, error)
- func (c *Client) Incr(key string, delta uint64) (uint64, error)
- func (c *Client) Prepend(item *Item) error
- func (c *Client) Replace(item *Item) error
- func (c *Client) Set(item *Item) error
- type ConnType
- type Connection
- type Item
- type ServerList
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEstablishConnection = errors.New("failed to establish connection") ErrNoServers = errors.New("no servers are currently connected") ErrNotStored = errors.New("failed to store Value") ErrError = errors.New("incorrect syntax or error while saving the Value") ErrClientError = errors.New("failed to store Value while appending/prepending") ErrExists = errors.New("someone else has modified the CAS Value since last fetch") ErrCacheMiss = errors.New("key does not exist in the server") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the object that is exposed to the user. It allows the user to interact with the API.
func New ¶
New creates a client object. We need a list of addresses and also a number of connections we want to establish with each of the servers. These connections are later used in the connection pool.
func (*Client) CompareAndSwap ¶
CompareAndSwap sets the data if it is not updated since last fetch.
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection represents a single connection to a server. We want to hold the connection itself and also a ReadWriter due to optimizations.
type ServerList ¶
type ServerList struct {
// contains filtered or unexported fields
}
ServerList holds the list of all server addresses. It is concurrent-safe.
func (*ServerList) InitializeConnectionPool ¶
func (sl *ServerList) InitializeConnectionPool(connCount int) (map[string][]*Connection, error)
InitializeConnectionPool creates connections for server addresses.
Click to show internal directories.
Click to hide internal directories.