legacy_storage

package
v0.0.0-...-fdc8e6b Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("Key does not exist")
)

Errors

Functions

func InsertGob

func InsertGob(cache Storage, key string, e interface{}, ttl time.Duration) error

func InsertKV

func InsertKV(cache Storage, key, value string, ttl time.Duration) error

func RetrieveGob

func RetrieveGob(cache Storage, key string, e interface{}) error

func RetrieveKV

func RetrieveKV(cache Storage, key string) (string, error)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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