Documentation ¶
Index ¶
- Variables
- func InsertGob(cache Storage, key string, e interface{}, ttl time.Duration) error
- func InsertKV(cache Storage, key, value string, ttl time.Duration) error
- func RetrieveGob(cache Storage, key string, e interface{}) error
- func RetrieveKV(cache Storage, key string) (string, error)
- type Storage
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = errors.New("Key does not exist")
)
Errors
Functions ¶
func RetrieveGob ¶
Types ¶
type Storage ¶
type Storage interface { // Insert a new value into the store Insert(key string, value []byte, ttl time.Duration) error // Retrieve will attempt to find the key in the store. Returns // nil if it does not exist with an ErrNotFound Retrieve(key string) ([]byte, error) // Flush will empty the store Flush() error // Len returns the number of keys in the store (eg. Length of the cache/Count of items) Len() uint // Size returns the bytes used to store the keys Size() uint64 // Close the cache store and any associated resources. Close() }
Storage is the basic interface implemented by associated stores Todo: Standardise on how errors are returned when key is not in store
Click to show internal directories.
Click to hide internal directories.