cache

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingKey = errors.New("missing key")

Functions

This section is empty.

Types

type Cache

type Cache interface {
	//Save preserve provided value under given key
	Save(key string, value interface{})
	//GetSaved retrieve value under given key
	GetSaved(key string) (interface{}, error)
	//Reset turns cache into init state
	Reset()
	//All returns all cache entries
	All() map[string]interface{}
}

Cache is entity that has ability to store/retrieve arbitrary values

type DefaultCache

type DefaultCache struct {
	// contains filtered or unexported fields
}

DefaultCache is struct that has ability to store and retrieve arbitrary values

func New

func New() *DefaultCache

func (*DefaultCache) All

func (c *DefaultCache) All() map[string]interface{}

All returns all current DefaultCache data

func (*DefaultCache) GetSaved

func (c *DefaultCache) GetSaved(key string) (interface{}, error)

GetSaved returns preserved value from DefaultCache if present, error otherwise.

func (*DefaultCache) Reset

func (c *DefaultCache) Reset()

Reset turns DefaultCache into init state

func (*DefaultCache) Save

func (c *DefaultCache) Save(key string, value interface{})

Save preserve value under given key in DefaultCache.

Jump to

Keyboard shortcuts

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