cache

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("key not found in cache")
View Source
var GlobalCacheExpirationInSec int32 = 600 // 10 min
View Source
var LocalCacheExpirationInSec = 600 // 10 min

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Use(key string, getter func() (interface{}, error), result interface{}) (err error)
	Invalidate()
}

func New

func New(memcachedUrls []string) Cache

type GlobalCache

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

func NewGlobal

func NewGlobal(urls []string, expiration int32) *GlobalCache

func (*GlobalCache) Get

func (this *GlobalCache) Get(key string) (value []byte, err error)

func (*GlobalCache) Invalidate

func (this *GlobalCache) Invalidate()

func (*GlobalCache) Set

func (this *GlobalCache) Set(key string, value []byte)

func (*GlobalCache) Use

func (this *GlobalCache) Use(key string, getter func() (interface{}, error), result interface{}) (err error)

type LocalCache

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

func NewLocal

func NewLocal(expiration int) *LocalCache

func (*LocalCache) Get

func (this *LocalCache) Get(key string) (value []byte, err error)

func (*LocalCache) Invalidate

func (this *LocalCache) Invalidate()

func (*LocalCache) Set

func (this *LocalCache) Set(key string, value []byte)

func (*LocalCache) Use

func (this *LocalCache) Use(key string, getter func() (interface{}, error), result interface{}) (err error)

Jump to

Keyboard shortcuts

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