Documentation ¶
Overview ¶
Package gokv implements a set of drivers and a common interface for working with different key/value storage systems
Index ¶
- type Client
- func (c *Client) AddNode(name string, node kv.Store) error
- func (c *Client) Del(key string) (err error)
- func (c *Client) Get(key string, dstVal interface{}) (err error)
- func (c *Client) RemoveNode(name string) error
- func (c *Client) ReplaceNode(name string, node kv.Store) error
- func (c *Client) ReplicateToN(numNodes int) error
- func (c *Client) Set(key string, value interface{}) (err error)
- func (c *Client) SetNode(name string, node kv.Store) error
- func (c *Client) SetReplicateMethod(m ReplicationMethod)
- type ReplicationMethod
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is a cache client with built in replication to any number of different caches. This allows replication and syncronization across various caches using the set of drivers available as subpackages, including Memcached, Redis, in-memory caches, and more.
func (*Client) AddNode ¶
AddNode adds a cache node with the given name, but only if it doesn't already exist
func (*Client) Del ¶
Del implements the "kv.Store".Del() interface. It deletes the given key across all replicated nodes and returns error if any of those delete operations fail.
func (*Client) Get ¶
Get implements the "kv.Store".Get() interface. It checks nodes in order of priority, and returns success if the value exists on any of them.
func (*Client) RemoveNode ¶
RemoveNode removes a node with the given name from the node list
func (*Client) ReplaceNode ¶
ReplaceNode adds a cache node with the given name, but only if it already exists
func (*Client) ReplicateToN ¶
ReplicateToN sets how many nodes each key should be replicated to
func (*Client) SetNode ¶
SetNode sets the cache node with the given name, regardless of whether it already exists or not
func (*Client) SetReplicateMethod ¶
func (c *Client) SetReplicateMethod(m ReplicationMethod)
SetReplicateMethod sets the replication method
type ReplicationMethod ¶
type ReplicationMethod int
ReplicationMethod determines whether replication takes place asyncronously or syncronously. Use ReplicateAsync for asyncronous replication, ReplicateSync for syncronous replication.
const ( // ReplicateAsync indicates that replication will be done asyncronously. // Set commands will return without error as soon as at least one node has // the value ReplicateAsync ReplicationMethod = iota // ReplicateSync indicates that replication will be done syncronously. // Set commands will return without error only if all nodes return without error ReplicateSync = iota )