store

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Pools = map[string]Store{}

Pools LRU pools

View Source
var StoreHandlers = map[string]process.Handler{
	"get":    processStoreGet,
	"set":    processStoreSet,
	"has":    processStoreHas,
	"del":    processStoreDel,
	"getdel": processStoreGetDel,
	"len":    processStoreLen,
	"keys":   processStoreKeys,
	"clear":  processStoreClear,
}

StoreHandlers store process handlers

Functions

This section is empty.

Types

type Instance added in v0.10.3

type Instance struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description,omitempty"`
	Connector   string                 `json:"connector,omitempty"`
	Type        string                 `json:"type,omitempty"` // warning: type is deprecated in the future new version
	Option      map[string]interface{} `json:"option,omitempty"`
}

Instance the kv-store setting

type Option

type Option map[string]interface{}

Option the store option

type Store

type Store interface {
	Get(key string) (value interface{}, ok bool)
	Set(key string, value interface{}, ttl time.Duration) error
	Del(key string) error
	Has(key string) bool
	Len() int
	Keys() []string
	Clear()
	GetSet(key string, ttl time.Duration, getValue func(key string) (interface{}, error)) (interface{}, error)
	GetDel(key string) (value interface{}, ok bool)
	GetMulti(keys []string) map[string]interface{}
	SetMulti(values map[string]interface{}, ttl time.Duration)
	DelMulti(keys []string)
	GetSetMulti(keys []string, ttl time.Duration, getValue func(key string) (interface{}, error)) map[string]interface{}
}

Store The interface of a key-value store

func Load added in v0.10.3

func Load(file string, name string) (Store, error)

Load load kv store

func New

func New(c connector.Connector, option Option) (Store, error)

New create a store via connector

func Select added in v0.10.3

func Select(name string) Store

Select Select loaded kv store

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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