Help us shape the future of Go! Take the 2026 Go Developer Survey

caches

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: AGPL-3.0 Imports: 1 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] interface {
	Get(key K, loader func(K) (V, error)) (V, error)
}

func NewLFU

func NewLFU[K comparable, V any](opts ...Options) Cache[K, V]

func NewUnlimited

func NewUnlimited[K comparable, V any](opts ...Options) Cache[K, V]

type LFU

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

func (*LFU[K, V]) Get

func (c *LFU[K, V]) Get(key K, loader func(K) (V, error)) (V, error)

func (*LFU[K, V]) Len

func (c *LFU[K, V]) Len() int

type Lazy

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

func NewLazy

func NewLazy[T any](loader func() (T, error)) *Lazy[T]

func (*Lazy[T]) Get

func (l *Lazy[T]) Get() (T, error)

type Options

type Options struct {
	MaxSize      int
	LevelFactor  int
	LevelMinSize int
}

type Unlimited

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

func (*Unlimited[K, V]) Get

func (c *Unlimited[K, V]) Get(key K, loader func(K) (V, error)) (V, error)

func (*Unlimited[K, V]) Len

func (c *Unlimited[K, V]) Len() int

Jump to

Keyboard shortcuts

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