ristretto

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

View Source
const (
	NumCounters = "num_counters"
	MaxCost     = "max_cost"
	BufferItems = "buffer_items"
	Metrics     = "metrics"
)
View Source
const (
	DefaultNumCounters = 1000
	DefaultMaxCost     = 1000000
	DefaultBufferItems = 64
	DefalutMetrics     = false
)

Variables

This section is empty.

Functions

func NewStore

func NewStore() kvcache.Service

NewStore returns a new FoundationDB store instance.

func NewStoreWith

func NewStoreWith(kvStore kv.Store) kvcache.Service

NewStoreWith returns a new FoundationDB store instance with the specified key coder.

func NewTransaction

func NewTransaction(txn kv.Transaction, store *Store) kv.Transaction

Types

type Store

type Store struct {
	*kvcache.BaseStore
	Cache *ristretto.Cache
}

Store represents a cache store service instance.

func (*Store) EraseCache

func (store *Store) EraseCache(key kv.Key) error

EraseCache deletes a cache for the specified key.

func (*Store) EraseCollectionCache

func (store *Store) EraseCollectionCache(database string, collection string) error

EraseCollectionCache deletes a cache for the specified collection.

func (*Store) EraseDatabaseCache

func (store *Store) EraseDatabaseCache(database string) error

EraseDatabaseCache deletes a cache for the specified database.

func (*Store) GeBufferItems

func (store *Store) GeBufferItems() (int64, error)

func (*Store) GeMetrics

func (store *Store) GeMetrics() (bool, error)

func (*Store) GetMaxCost

func (store *Store) GetMaxCost() (int64, error)

func (*Store) GetNumCounters

func (store *Store) GetNumCounters() (int64, error)

func (*Store) ServiceName

func (store *Store) ServiceName() string

ServiceName returns the plug-in service name.

func (*Store) SetCache

func (store *Store) SetCache(obj *kv.Object) error

SetCache sets a cache for the specified key.

func (*Store) Start

func (store *Store) Start() error

Start starts the ristretto store.

func (Store) Stop

func (store Store) Stop() error

Stop stops the ristretto store.

func (*Store) Transact

func (store *Store) Transact(write bool) (kv.Transaction, error)

Transact begin a new transaction.

type Transaction

type Transaction struct {
	kv.Transaction
	*Store
}

func (*Transaction) Get

func (txn *Transaction) Get(key kv.Key) (*kv.Object, error)

Get returns a key-value object of the specified key.

func (*Transaction) GetRange

func (txn *Transaction) GetRange(key kv.Key, opts ...kv.Option) (kv.ResultSet, error)

GetRange returns a result set of the specified key.

func (*Transaction) Set

func (txn *Transaction) Set(obj *kv.Object) error

Set stores a key-value object. If the key already holds some value, it is overwritten.

Jump to

Keyboard shortcuts

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