kvcache

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: Apache-2.0 Imports: 5 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
	// contains filtered or unexported fields
}

BaseStore represents a cache store service instance.

func NewBaseStore

func NewBaseStore() *BaseStore

NewStore returns a new FoundationDB store instance.

func (*BaseStore) CacheHitCount added in v1.2.0

func (store *BaseStore) CacheHitCount() int64

CacheMissCount returns the number of cache misses.

func (*BaseStore) CacheHitRate added in v1.2.0

func (store *BaseStore) CacheHitRate() float64

CacheMissCount returns the number of cache misses.

func (*BaseStore) CacheMissCount added in v1.2.0

func (store *BaseStore) CacheMissCount() int64

CacheMissCount returns the number of cache misses.

func (*BaseStore) CacheMissRate added in v1.2.0

func (store *BaseStore) CacheMissRate() float64

CacheMissRate returns the cache miss rate.

func (*BaseStore) CacheRequestCount added in v1.2.0

func (store *BaseStore) CacheRequestCount() int64

CacheRequestCount returns the number of cache requests.

func (*BaseStore) IncrementHitCount added in v1.2.0

func (store *BaseStore) IncrementHitCount()

IncrementHitCount increments the number of cache hits.

func (*BaseStore) IncrementRequestCount added in v1.2.0

func (store *BaseStore) IncrementRequestCount()

IncrementRequestCount increments the number of cache requests.

func (*BaseStore) ServiceType

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

ServiceType returns the plug-in 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 CacheStatus added in v1.2.0

type CacheStatus interface {
	// CacheRequestCount returns the number of cache requests.
	CacheRequestCount() int64
	// CacheMissCount returns the number of cache misses.
	CacheHitCount() int64
}

CacheStatus represents a key-value cache store status interface.

type CacheStatusExt added in v1.2.0

type CacheStatusExt interface {
	// CacheMissCount returns the number of cache misses.
	CacheHitRate() float64
	// CacheMissCount returns the number of cache misses.
	CacheMissCount() int64
	// CacheMissRate returns the cache miss rate.
	CacheMissRate() float64
}

CacheStatusExt represents a key-value cache store status interface.

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
	CacheStatus
	CacheStatusExt
	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