cache

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[T any] interface {
	Clone(ctx context.Context, exp time.Duration) Cache[T]
	Close()
	Clean()

	Merge(c Cache[T])
	Walk(fct func(key any, val interface{}, exp time.Duration) bool)

	Load(key any) (val interface{}, exp time.Duration, ok bool)
	Store(key any, val interface{}) time.Duration
	Delete(key any)

	LoadOrStore(key any, val interface{}) (res interface{}, exp time.Duration, loaded bool)
	LoadAndDelete(key any) (val interface{}, loaded bool)
}

func New

func New[T any](ctx context.Context, exp time.Duration) Cache[T]

type FuncCache

type FuncCache[T any] func() Cache[T]

Jump to

Keyboard shortcuts

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