cache

package
v1.9.10 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package cache provides generic cache types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparer

type Comparer[E any] interface {
	Compare(e E) bool
}

Comparer is an interface defining a generic compare function.

type List

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

List is a generic cache list.

func NewList

func NewList[K Comparer[K], V any](maxEntries int, valueFn func(k K) V) *List[K, V]

NewList returns a new cache list.

func (*List[K, V]) Get

func (l *List[K, V]) Get(k K) V

Get returns the value for the given key.

Jump to

Keyboard shortcuts

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