cache

package
v0.0.0-...-2552c51 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LiveInfinite = time.Duration(-1)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheMap

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

func NewCacheMap

func NewCacheMap(ctx context.Context, maxSize int, live time.Duration) *CacheMap

func (*CacheMap) Clear

func (s *CacheMap) Clear()

func (*CacheMap) Delete

func (s *CacheMap) Delete(key any)

Delete removes cached object

func (*CacheMap) DeleteMulti

func (s *CacheMap) DeleteMulti(keys []any)

func (*CacheMap) Each

func (s *CacheMap) Each(callback func(any, any) bool)

Each implements a map bypass for each key using the callback function. If the callback function returns false, then the cycle stops

func (*CacheMap) EventCleaner

func (s *CacheMap) EventCleaner() <-chan map[any]any

func (*CacheMap) Get

func (s *CacheMap) Get(key any) (res any, check bool)

func (*CacheMap) GetCheck

func (s *CacheMap) GetCheck(key any, mCheck CallCheck) (res any, check bool)

func (*CacheMap) GetCreate

func (s *CacheMap) GetCreate(key any, mCreate CallCreate) (val any, check bool)

func (*CacheMap) GetCreateNew

func (s *CacheMap) GetCreateNew(key any, mCreateNew CallCreateNew) (rKey, val any, check bool)

func (*CacheMap) IsFinished

func (s *CacheMap) IsFinished() bool

func (*CacheMap) Keys

func (s *CacheMap) Keys() (res []any)

func (CacheMap) Len

func (s CacheMap) Len() (res int)

func (*CacheMap) Set

func (s *CacheMap) Set(key, value any)

func (*CacheMap) SetMulti

func (s *CacheMap) SetMulti(m map[any]any)

type CallCheck

type CallCheck func(key, value any, exists bool) (rKey, rValue any, created bool)

type CallCreate

type CallCreate func(key any) (value any, created bool)

type CallCreateNew

type CallCreateNew func(key any) (rKey, value any, created bool)

Jump to

Keyboard shortcuts

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