Documentation ¶
Index ¶
Constants ¶
const (
// Name of the Key/Value Store within the registry
Name = "redis"
)
Variables ¶
This section is empty.
Functions ¶
func New ¶
New creates a new KVStore which persists its data on Redis. It requires at least a config value for "url". Further config values are:
- db(optional) The database number. Must be parseable to an int
- connection_timeout (optional) The timeout after which a connection attempt to Redis is abandoned. Must be parseable to time.Duration
- read_timeout (optional) The timeout after which a single read operation is abandoned. Must be parseable to time.Duration
- write_timeout (optional) The timeout after which a single write operation is abandoned. Must be parseable to time.Duration
- use_tls (optional) Wether to use TLS to connect to Redis or not. Must be parseable to a boolean.
- tls_skip_verify (optional) Wether to validate the server's certificate or not. Only evaluated when use_tls is true. Must be parseable to a boolean.
- password (optional) String containing the password for Redis.
Types ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator statisfies both the PrefixIterator and the RangeIterator interface. As PrefixIterator, it will visit all K/V pairs with the provided prefix. As RangeIterator, it will visit all K/V pairs between start and end.
func (Iterator) Key ¶
Key returns the key pointed to by the iterator The bytes returned are **ONLY** valid until the next call to Seek/Next/Close Continued use after that requires that they be copied.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader implements the KVReader interface for a Redis backend.
func (Reader) Get ¶
Get returns the value associated with the key If the key does not exist, nil is returned. The caller owns the bytes returned.
func (Reader) PrefixIterator ¶
func (r Reader) PrefixIterator(prefix []byte) store.KVIterator
PrefixIterator returns a KVIterator that will visit all K/V pairs with the provided prefix
func (Reader) RangeIterator ¶
func (r Reader) RangeIterator(start, end []byte) store.KVIterator
RangeIterator returns a KVIterator that will visit all K/V pairs >= start AND < end
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements the KVStore interface for a Redis.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer is used to write values to Redis.
func (Writer) ExecuteBatch ¶
ExecuteBatch will execute the KVBatch, the provided KVBatch **MUST** have been created by the same KVStore (though not necessarily the same KVWriter) Batch execution is atomic, either all the operations or none will be performed
func (Writer) NewBatchEx ¶
NewBatchEx returns a KVBatch and an associated byte array that's pre-sized based on the KVBatchOptions. The caller can use the returned byte array for keys and values associated with the batch. Once the batch is either executed or closed, the associated byte array should no longer be accessed by the caller.