tinylfu

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 2 Imported by: 4

Documentation

Overview

Package tinylfu is an implementation of the TinyLFU caching algorithm

http://arxiv.org/abs/1512.00727

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option[K comparable, V any] func(*T[K, V])

func OnEvict

func OnEvict[K comparable, V any](f func(key K, old V)) Option[K, V]

func OnReplace

func OnReplace[K comparable, V any](f func(key K, old V)) Option[K, V]

type T

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

func New

func New[K comparable, V any](size int, samples int, hash func(K) uint64, options ...Option[K, V]) *T[K, V]

func (*T[K, V]) Add

func (t *T[K, V]) Add(key K, val V)

func (*T[K, V]) Get

func (t *T[K, V]) Get(key K) (V, bool)

Directories

Path Synopsis
internal
list
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