cache

package
v0.0.0-...-d3bc976 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvictCallback

type EvictCallback[K comparable, V any] func(key K, value V)

type LruCache

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

func New

func New[K comparable, V any](options ...Option[K, V]) *LruCache[K, V]

func (*LruCache[K, V]) CloneTo

func (c *LruCache[K, V]) CloneTo(n *LruCache[K, V])

func (*LruCache[K, V]) Delete

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

Delete removes the value associated with a key.

func (*LruCache[K, V]) Exist

func (c *LruCache[K, V]) Exist(key K) bool

func (*LruCache[K, V]) Load

func (c *LruCache[K, V]) Load(key K) (V, bool)

func (*LruCache[K, V]) LoadOrStore

func (c *LruCache[K, V]) LoadOrStore(key K, constructor func() V) (V, bool)

func (*LruCache[K, V]) LoadOrStoreWithAge

func (c *LruCache[K, V]) LoadOrStoreWithAge(key K, maxAge int64, constructor func() V) (V, bool)

func (*LruCache[K, V]) LoadWithExpire

func (c *LruCache[K, V]) LoadWithExpire(key K) (V, time.Time, bool)

func (*LruCache[K, V]) Range

func (c *LruCache[K, V]) Range(block func(key K, value V))

func (*LruCache[K, V]) Store

func (c *LruCache[K, V]) Store(key K, value V)

func (*LruCache[K, V]) StoreWithExpire

func (c *LruCache[K, V]) StoreWithExpire(key K, value V, expires time.Time)

type Option

type Option[K comparable, V any] func(*LruCache[K, V])

func WithAge

func WithAge[K comparable, V any](maxAge int64) Option[K, V]

func WithEvict

func WithEvict[K comparable, V any](cb EvictCallback[K, V]) Option[K, V]

func WithSize

func WithSize[K comparable, V any](maxSize int) Option[K, V]

func WithStale

func WithStale[K comparable, V any](stale bool) Option[K, V]

func WithUpdateAgeOnGet

func WithUpdateAgeOnGet[K comparable, V any]() Option[K, V]

Jump to

Keyboard shortcuts

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