cache

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ZeroCost with this ristretto uses the Cost function defined in its configuration
	ZeroCost = 0
)

Variables

This section is empty.

Functions

func NewDefaultRistrettoCache

func NewDefaultRistrettoCache[T any]() (*ristrettoCache[T], error)

func NewRistrettoCache

func NewRistrettoCache[T any](config *ristretto.Config[string, T]) (*ristrettoCache[T], error)

NewRistrettoCache creates and returns a new ristretto-based cache implementation.

Types

type Config

type Config[K ristretto.Key, V any] = ristretto.Config[K, V]

Config is a shortcut for the ristretto Configuration.

type NoCache

type NoCache[T any] struct {
}

NoCache implements a dummy cache that does nothing

func NewNoCache

func NewNoCache[T any]() *NoCache[T]

NewNoCache returns a new instance of NoCache

func (*NoCache[T]) Add

func (n *NoCache[T]) Add(key string, value T)

func (*NoCache[T]) Delete

func (n *NoCache[T]) Delete(key string)

func (*NoCache[T]) Get

func (n *NoCache[T]) Get(key string) (T, bool)

func (*NoCache[T]) GetOrLoad

func (n *NoCache[T]) GetOrLoad(key string, loader func() (T, error)) (T, bool, error)

Jump to

Keyboard shortcuts

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