cache

package
v0.0.0-...-9c44629 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCache

func NewCache(size int64) *dbCache

Types

type BigCache

type BigCache struct {
	Shards             int           `json:"shards"`
	LifeWindowMinutes  int           `json:"lifeWindowMinutes"`
	HardMaxCacheSizeMb int           `json:"hardMaxCacheSizeMb"`
	MaxEntrySize       int           `json:"maxEntrySize"`
	RefreshInSeconds   time.Duration `json:"refreshInSeconds"`
}

type Cache

type Cache interface {
	Get(key interface{}) (value interface{}, ok bool)
	Add(key interface{}, value interface{})
	Remove(key interface{})
}

type DBCache

type DBCache struct {
	*lru.ARCCache
	context.Context
	RefreshInSeconds time.Duration
}

func New

func New(ctx context.Context, refreshInSeconds time.Duration) *DBCache

func (*DBCache) Add

func (s *DBCache) Add(key interface{}, value interface{})

func (*DBCache) Get

func (s *DBCache) Get(key interface{}) (value interface{}, ok bool)

func (*DBCache) Remove

func (s *DBCache) Remove(key interface{})

Jump to

Keyboard shortcuts

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