ristretto

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrItemDropped = errors.New("item dropped")

ErrItemDropped signifies that the item to store was not inserted into the cache.

See: https://godoc.org/github.com/dgraph-io/ristretto#Cache.Set

Functions

This section is empty.

Types

type RistrettoStore

type RistrettoStore struct {
	Cache *ristretto.Cache
}

RistrettoStore is used to create an in-memory ristretto cache.

See: https://godoc.org/github.com/dgraph-io/ristretto

func NewRistrettoStore

func NewRistrettoStore(config *ristretto.Config) *RistrettoStore

NewRistrettoStore creates an in-memory ristretto cache.

See: https://godoc.org/github.com/dgraph-io/ristretto#Config

func (*RistrettoStore) Close

func (r *RistrettoStore) Close()

Close returns the connection back to the pool for storage drivers that utilize a pool. For this driver, it does nothing.

func (*RistrettoStore) Conn

Conn does nothing for this storage driver.

func (*RistrettoStore) Forget

func (r *RistrettoStore) Forget(key string) error

Forget clears the value from the cache for the particular key.

See: https://godoc.org/github.com/dgraph-io/ristretto#Cache.Del

func (*RistrettoStore) ForgetAll

func (r *RistrettoStore) ForgetAll() error

ForgetAll clears all values from the cache. Note that this is not an atomic operation.

See: https://godoc.org/github.com/dgraph-io/ristretto#Cache.Clear

func (*RistrettoStore) Get

func (r *RistrettoStore) Get(key string) (_ interface{}, found bool, _ error)

Get returns a value from the cache if the key exists. It is possible for nil to be returned while found is also true.

See: https://godoc.org/github.com/dgraph-io/ristretto#Cache.Get

func (*RistrettoStore) Set

func (r *RistrettoStore) Set(key string, cost time.Duration, itemToStore interface{}) error

Set sets a item into the cache for a particular key. cost must be converted to a time.Duration despite being unrelated to time.

See: https://godoc.org/github.com/dgraph-io/ristretto#Cache.Set

func (*RistrettoStore) StorePointer

func (r *RistrettoStore) StorePointer() bool

StorePointer sets whether a storage driver requires itemToStore to be stored as a pointer or as a concrete value.

Jump to

Keyboard shortcuts

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