ristretto

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT 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 ristretto.Key, V any] struct {
	*ristretto.Cache[K, V]
	Conf Config[K, V]
}

func (*Cache[K, V]) Close

func (c *Cache[K, V]) Close() error

Close closes the Ristretto cache if it is non-nil.

func (*Cache[K, V]) Config

func (c *Cache[K, V]) Config() any

Config returns the embedded Conf as the configuration for injection.

func (*Cache[K, V]) Init

func (c *Cache[K, V]) Init() error

Init creates the Ristretto cache and stores it.

type Config

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

func (*Config[K, V]) AfterInject

func (c *Config[K, V]) AfterInject()

AfterInject sets default NumCounters, MaxCost and BufferItems when not configured.

func (*Config[K, V]) BeforeInject

func (c *Config[K, V]) BeforeInject()

BeforeInject is a no-op satisfying the Config interface.

func (*Config[K, V]) Build

func (c *Config[K, V]) Build() (*ristretto.Cache[K, V], error)

Build creates a Ristretto in-memory cache with the configured settings.

func (*Config[K, V]) Init

func (c *Config[K, V]) Init() *Config[K, V]

Init is a no-op placeholder; default values are set in AfterInject.

Jump to

Keyboard shortcuts

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