safecache

package
v0.0.43 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: BSD-3-Clause Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](initFunc func() (T, error), bypassFunc func() bool) *Cache[T]

func (*Cache[T]) Get

func (c *Cache[T]) Get() (T, error)

type CacheMap added in v0.0.29

type CacheMap[K any, DK comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewMap added in v0.0.29

func NewMap[K any, DK comparable, V any](
	initFunc mapInitFunc[K, V],
	mapToKeyFunc mapToKeyFunc[K, DK],
	bypassFunc mapBypassFunc[K],
) *CacheMap[K, DK, V]

func (*CacheMap[K, DK, V]) Get added in v0.0.29

func (c *CacheMap[K, DK, V]) Get(key K) (V, error)

Jump to

Keyboard shortcuts

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