kvstore

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func Ensure

func Ensure(s KVStore, key string, newValue []byte) ([]byte, error)

func LoadJSON

func LoadJSON(s KVStore, key string, v interface{}) error

func StoreJSON

func StoreJSON(s KVStore, key string, v interface{}) error

Types

type KVStore

type KVStore interface {
	Load(key string) ([]byte, error)
	Store(key string, data []byte) error
	StoreTTL(key string, data []byte, ttlSeconds int64) error
	StoreWithOptions(key string, value []byte, opts model.PluginKVSetOptions) (bool, error)
	Delete(key string) error
}

func NewHashedKeyStore

func NewHashedKeyStore(s KVStore, prefix string) KVStore

func NewPluginStore

func NewPluginStore(api plugin.API) KVStore

func NewPluginStoreWithExpiry

func NewPluginStoreWithExpiry(api plugin.API, ttl time.Duration) KVStore

type OneTimeStore

type OneTimeStore KVStore

OneTimeStore is a KV store that deletes each record after the first load,

func NewOneTimePluginStore

func NewOneTimePluginStore(api plugin.API, ttl time.Duration) OneTimeStore

func NewOneTimeStore

func NewOneTimeStore(kv KVStore) OneTimeStore

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL