Documentation ¶
Overview ¶
Package remotekv contains remote key-value storage interfaces, helpers, and implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a local cache implementation of the Interface interface.
func NewCache ¶
func NewCache(c *CacheConfig) (kv *Cache)
NewCache returns a new *Cache. c must not be nil.
type CacheConfig ¶
type CacheConfig struct { // Cache is the underlying cache. Cache agdcache.Interface[string, []byte] }
CacheConfig is the configuration for the local cache Interface implementation. All fields must not be empty.
type Empty ¶
type Empty struct{}
Empty is the Interface implementation that does nothing.
type Interface ¶
type Interface interface { // Get returns val by key from the storage. ok is true if val by key // exists. Get(ctx context.Context, key string) (val []byte, ok bool, err error) // Set sets val into the storage by key. Set(ctx context.Context, key string, val []byte) (err error) }
Interface is the remote key-value storage interface.
type KeyNamespace ¶
type KeyNamespace struct {
// contains filtered or unexported fields
}
KeyNamespace is wrapper around Interface that adds a custom prefix to the keys.
func NewKeyNamespace ¶
func NewKeyNamespace(conf *KeyNamespaceConfig) (n *KeyNamespace)
NewKeyNamespace returns a properly initialized *KeyNamespace. conf must not be nil.
type KeyNamespaceConfig ¶
type KeyNamespaceConfig struct { // KV is the key-value storage to be wrapped. It must not be nil. KV Interface // Prefix is the custom prefix to be added to the keys. Prefix should be in // accordance with the wrapped KV storage keys. Prefix string }
KeyNamespaceConfig is the configuration structure for KeyNamespace.
Directories ¶
Path | Synopsis |
---|---|
Package consulkv contains implementation of remotekv.Interface for Consul key-value storage.
|
Package consulkv contains implementation of remotekv.Interface for Consul key-value storage. |
Package rediskv contains implementation of remotekv.Interface for Redis.
|
Package rediskv contains implementation of remotekv.Interface for Redis. |