kvcache

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSetCache = errors.New("set cache error")

ErrSetCache is returned when the cache is set.

Functions

func NewErrSetCache

func NewErrSetCache(key kv.Key) error

NewErrSetCache returns a new ErrSetCache.

Types

type BaseCacheStore

type BaseCacheStore interface {
	kv.Store
	// SetStore sets a base key-value store.
	SetStore(s kv.Store)
	// RegisterCacheKeyPrefix registers a key header for the cache store.
	RegisterCacheKeyHeader(header kv.KeyHeader)
	// IsRegisteredCacheKey returns true if the specified key is registered to the cache store.
	IsRegisteredCacheKey(key kv.Key) bool
	// EraseCache deletes a cache for the specified key.
	EraseCache(key kv.Key) error
}

BaseCacheStore represents a base key-value cache store interface.

type BaseStore

type BaseStore struct {
	plugins.Config
	kv.Store
	*CacheConfig
}

BaseStore represents a cache store service instance.

func NewBaseStore

func NewBaseStore() *BaseStore

NewStore returns a new FoundationDB store instance.

func (*BaseStore) ServiceType

func (store *BaseStore) ServiceType() plugins.ServiceType

ServiceType returns the plug-ing service type.

func (*BaseStore) SetStore

func (store *BaseStore) SetStore(s kv.Store)

SetStore sets the key-value store service.

type CacheConfig

type CacheConfig struct {
	// contains filtered or unexported fields
}

CacheConfig represents a key-value cache store configuration.

func NewCacheConfig

func NewCacheConfig() *CacheConfig

NewCacheConfig returns a new key-value cache store configuration.

func (*CacheConfig) EnableCollectionCache

func (conf *CacheConfig) EnableCollectionCache()

EnableCollectionCache enables a cache for all database collections.

func (*CacheConfig) EnableDatabaseCache

func (conf *CacheConfig) EnableDatabaseCache()

EnableDatabaseCache enables a cache for all databases.

func (*CacheConfig) IsRegisteredCacheKey

func (conf *CacheConfig) IsRegisteredCacheKey(key kv.Key) bool

IsRegisteredCacheKey returns true if the specified key is registered to the cache store.

func (*CacheConfig) RegisterCacheKeyHeader

func (conf *CacheConfig) RegisterCacheKeyHeader(header kv.KeyHeader)

RegisterCacheKeyPrefix registers a key header for the cache store.

func (*CacheConfig) UnregisterCacheKeyHeader

func (conf *CacheConfig) UnregisterCacheKeyHeader(header kv.KeyHeader)

UnregisterCacheKeyPrefix unregisters a key header for the cache store.

type CacheStore

type CacheStore interface {
	BaseCacheStore
	// EnableDatabaseCache enables a cache for all databases.
	EnableDatabaseCache()
	// EnableCollectionCache enables a cache for all database collections.
	EnableCollectionCache()
	// EraseDatabaseCache deletes a cache for the specified database.
	EraseDatabaseCache(database string) error
	// EraseCollectionCache deletes a cache for the specified collection.
	EraseCollectionCache(database string, collection string) error
}

CacheStore represents a key-value cache store interface.

type Service

type Service interface {
	CacheStore
	plugins.Service
}

Service represents a key-value cache store service interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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