cache

package module
v0.0.0-...-f5c57c2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 1 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrElementNotFound is returned when element isn't found in the cache.
	ErrElementNotFound = fmt.Errorf("unable to find element")
)

Functions

This section is empty.

Types

type Cache

type Cache[K comparable, V Value] interface {
	// Put stores the given (key,value) pair, replacing existing value if
	// key already exists. The return value indicates whether items had to
	// be evicted to make room for the new element.
	Put(key K, value V) (bool, error)

	// Get returns the value for a given key.
	Get(key K) (V, error)

	// Len returns number of elements in the cache.
	Len() int
}

Cache represents a generic cache.

type Value

type Value interface {
	// Size determines how big this entry would be in the cache. For
	// example, for a filter, it could be the size of the filter in bytes.
	Size() (uint64, error)
}

Value represents a value stored in the Cache.

Directories

Path Synopsis
Package list implements a doubly linked list.
Package list implements a doubly linked list.

Jump to

Keyboard shortcuts

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