Documentation ¶
Index ¶
- Constants
- Variables
- type RistrettoStore
- func (r *RistrettoStore) Close()
- func (r *RistrettoStore) Conn(ctx context.Context) (remember.Cacher, error)
- func (r *RistrettoStore) Forget(key string) error
- func (r *RistrettoStore) ForgetAll() error
- func (r *RistrettoStore) Get(key string) (_ interface{}, found bool, _ error)
- func (r *RistrettoStore) Set(key string, expiration time.Duration, itemToStore interface{}) error
- func (r *RistrettoStore) StorePointer() bool
Constants ¶
const NoExpiration time.Duration = 0
NoExpiration is used to indicate that data should not expire from the cache.
Variables ¶
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 ¶
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, defaultCost ...int64) *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 ¶
func (r *RistrettoStore) Conn(ctx context.Context) (remember.Cacher, error)
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, expiration time.Duration, itemToStore interface{}) error
Set sets a item into the cache for a particular key. The cost is always set to 1, unless over-ridden at creation.
See: https://godoc.org/github.com/dgraph-io/ristretto#Cache.SetWithTTL
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.