cache

package
v0.0.0-...-ff5ca92 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKey

func NewKey(body []byte) lru.Key

NewKey creates new sha256-encoded byte key for the Cache

Types

type Cache

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

Cache is a thread-safe wrapper around groupcache's LRU cache implementation It holds positive int64 values with []byte keys

func New

func New(cfg *viper.Viper) (*Cache, error)

New creates new instance of Cache

func (*Cache) Add

func (c *Cache) Add(key lru.Key, value []byte)

Add adds the value to Cache

func (*Cache) Clear

func (c *Cache) Clear()

Clear purges the Cache

func (*Cache) Get

func (c *Cache) Get(key lru.Key) ([]byte, bool)

Get acquires value from Cache

func (*Cache) Len

func (c *Cache) Len() int

Len returns the current Cache length

func (*Cache) Remove

func (c *Cache) Remove(key lru.Key)

Remove removes the value from Cache

Jump to

Keyboard shortcuts

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