cache

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanWindow

func CleanWindow(l time.Duration) func(*bigcache.Config)

CleanWindow functional option

func LifeWindow

func LifeWindow(l time.Duration) func(*bigcache.Config)

LifeWindow functional option

func MaxEntriesInWindow

func MaxEntriesInWindow(m int) func(*bigcache.Config)

MaxEntriesInWindow functional option

func MaxEntrySize

func MaxEntrySize(m int) func(*bigcache.Config)

MaxEntrySize functional option

func Shards

func Shards(s int) func(*bigcache.Config)

Shards functional option

func Verbose

func Verbose(v bool) func(*bigcache.Config)

Verbose functional option

Types

type AllegroBigCache

type AllegroBigCache struct {
	*bigcache.BigCache
}

AllegroBigCache is the struct holding the Cache layer object

func NewAllegroBigCache

func NewAllegroBigCache(opts ...func(*bigcache.Config)) (*AllegroBigCache, error)

NewAllegroBigCache returns a new AllegroCache object

func (*AllegroBigCache) Close

func (ac *AllegroBigCache) Close()

Close closes the cache once it is not necessary anymore

func (*AllegroBigCache) Del

func (ac *AllegroBigCache) Del(key string) bool

Del deletes the entry from the cache layer

func (*AllegroBigCache) Empty

func (ac *AllegroBigCache) Empty() bool

Empty clears the cache

func (*AllegroBigCache) Get

func (ac *AllegroBigCache) Get(key string) ([]models.ItemScore, bool)

Get returns the value associated with the particular key

func (*AllegroBigCache) Set

func (ac *AllegroBigCache) Set(key string, value []models.ItemScore) bool

Set stores a key/value pair with specified weight into the cache layer

type Cache

type Cache interface {
	Set(key string, value []models.ItemScore) bool
	Get(key string) ([]models.ItemScore, bool)
	Del(key string) bool
	Empty() bool
}

Cache is the interface that will be used to create a caching layer to speedup the serving of the recommendations

Jump to

Keyboard shortcuts

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