cache

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCacheItemNotFound = errors.New("cache item not found")
)

Functions

This section is empty.

Types

type Cache

type Cache interface {
	GetOrSet(k interface{}, setFn SetFn) (v interface{}, err error)
}

type ChanLocker

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

func NewChanLocker

func NewChanLocker() *ChanLocker

func (ChanLocker) Lock

func (c ChanLocker) Lock(v interface{}, onAcquireFn func()) (acquired bool)

type GetSetCache

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

func NewCache

func NewCache(size int, expiry time.Duration, jitterFn JitterFn) *GetSetCache

func (*GetSetCache) GetOrSet

func (c *GetSetCache) GetOrSet(k interface{}, setFn SetFn) (v interface{}, err error)

type JitterFn

type JitterFn func() time.Duration

func NewJitterFn

func NewJitterFn(jitter time.Duration) JitterFn

type Locker

type Locker interface {
	Lock(v interface{}, onAcquireFn func())
}

type SetFn

type SetFn func() (v interface{}, err error)

Jump to

Keyboard shortcuts

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