lru

package
v0.0.0-...-1f8a15b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.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 {
	*lru.Cache[K, V]
	// contains filtered or unexported fields
}

Cache is a wrapper around hashicorp lru but with metric for Get

func New

func New[K comparable, V any](metricName string, size int) (*Cache[K, V], error)

func NewWithEvict

func NewWithEvict[K comparable, V any](metricName string, size int, fn func(K, V)) (*Cache[K, V], error)

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(k K) (V, bool)

Jump to

Keyboard shortcuts

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