cache

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: Apache-2.0 Imports: 5 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 None = &NoneCache{}

Functions

This section is empty.

Types

type Cache

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

type CacheImpl

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

func NewCache

func NewCache(expiration time.Duration) *CacheImpl

func (*CacheImpl) Invalidate

func (this *CacheImpl) Invalidate(key string) (err error)

func (*CacheImpl) Use

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

func (*CacheImpl) UseWithExpirationInResult

func (this *CacheImpl) UseWithExpirationInResult(key string, getter func() (interface{}, time.Duration, error), result interface{}) (err error)

type Item

type Item struct {
	Key   string
	Value []byte
}

type NoneCache

type NoneCache struct{}

func (*NoneCache) Invalidate

func (this *NoneCache) Invalidate(key string) (err error)

func (*NoneCache) Use

func (this *NoneCache) 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