lru

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 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[K comparable, V any] struct {
	Expiry          time.Duration
	CleanupInterval time.Duration
	New             func(K, *Entry[V]) error
	Evict           func(K, V)
	Singleflight    bool
	// contains filtered or unexported fields
}

func (*Cache[K, V]) Cleanup

func (c *Cache[K, V]) Cleanup()

func (*Cache[K, V]) Delete

func (c *Cache[K, V]) Delete(key K)

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(key K) (value V, err error)

func (*Cache[K, V]) GetEntry

func (c *Cache[K, V]) GetEntry(key K) (value *Entry[V], err error)

func (*Cache[K, V]) GetEntryIf

func (c *Cache[K, V]) GetEntryIf(key K) (value *Entry[V], ok bool)

func (*Cache[K, V]) GetIf

func (c *Cache[K, V]) GetIf(key K) (value V, ok bool)

func (*Cache[K, V]) Replace

func (c *Cache[K, V]) Replace(key K, value V)

func (*Cache[K, V]) ReplaceEntry

func (c *Cache[K, V]) ReplaceEntry(key K, v *Entry[V])

func (*Cache[K, V]) Set

func (c *Cache[K, V]) Set(key K, value V) (result V, ok bool)

func (*Cache[K, V]) SetEntry

func (c *Cache[K, V]) SetEntry(key K, v *Entry[V]) (result *Entry[V], ok bool)

type Entry

type Entry[V any] struct {
	Value V
	// contains filtered or unexported fields
}

func (*Entry[V]) Acquire

func (e *Entry[V]) Acquire()

func (*Entry[V]) Bump

func (e *Entry[V]) Bump()

func (*Entry[V]) Expired

func (e *Entry[V]) Expired(threshold time.Time) bool

func (*Entry[V]) Release

func (e *Entry[V]) Release()

Jump to

Keyboard shortcuts

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