localcache

package
v0.2.15 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 6 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[V any] struct {
	MaxEntries uint64
	// contains filtered or unexported fields
}

Cache is a small in-process cache facade backed by ttlcache.

func (*Cache[V]) Clear

func (c *Cache[V]) Clear()

func (*Cache[V]) Delete

func (c *Cache[V]) Delete(key string)

func (*Cache[V]) GetOrLoad

func (c *Cache[V]) GetOrLoad(
	key string,
	getData func() (V, error),
	timeout time.Duration,
) (value V)

func (*Cache[V]) GetOrLoadE

func (c *Cache[V]) GetOrLoadE(
	key string,
	getData func() (V, error),
	timeout time.Duration,
) (V, error)

func (*Cache[V]) Set

func (c *Cache[V]) Set(key string, value V, timeout time.Duration)

func (*Cache[V]) UpdateIfPresent

func (c *Cache[V]) UpdateIfPresent(key string, update func(V) V, timeout time.Duration) bool

Jump to

Keyboard shortcuts

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