Package cache contains caching functions.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
692 B

package cache
// Backend defines an interface for storing cached items.
type Backend interface {
// Len returns the number of unique keys in the cache
Len() int
// Contains checks if a key exists in the cache
Contains(key interface{}) (bool, error)
// Delete an item from the cache
Delete(key interface{}) (bool, error)
// Get an item from the cache
Get(key interface{}) (interface{}, bool, error)
// Iter iterates over all the key-value pairs in the cache
Iter(func(key, value interface{})) error
// Set an item in the cache
Set(key, value interface{}) error
// Replace an item in the cache if it exists, ignore otherwise
Replace(key, value interface{}) (bool, error)