lfu

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Admission added in v1.4.4

type Admission interface {
	Record(h uint64)
	Allow(candidate, victim uint64) bool
	Estimate(h uint64) uint8
	Reset()
}

func NewAdmission added in v1.4.4

func NewAdmission(cfg *config.Admission) Admission

type DiscardTinyLFU added in v1.7.0

type DiscardTinyLFU struct{}

func (*DiscardTinyLFU) Allow added in v1.7.0

func (a *DiscardTinyLFU) Allow(candidate, victim uint64) bool

func (*DiscardTinyLFU) Estimate added in v1.7.0

func (a *DiscardTinyLFU) Estimate(h uint64) uint8

func (*DiscardTinyLFU) Record added in v1.7.0

func (a *DiscardTinyLFU) Record(h uint64)

func (*DiscardTinyLFU) Reset added in v1.7.0

func (a *DiscardTinyLFU) Reset()

type ShardedAdmitter added in v1.5.0

type ShardedAdmitter struct {
	// contains filtered or unexported fields
}

func (*ShardedAdmitter) Allow added in v1.5.0

func (a *ShardedAdmitter) Allow(candidate, victim uint64) bool

Allow returns true if the candidate should replace a victim according to TinyLFU. If the candidate is unseen by the doorkeeper we conservatively reject (unless caller uses a small “window” segment to bypass admission).

func (*ShardedAdmitter) Estimate added in v1.5.0

func (a *ShardedAdmitter) Estimate(h uint64) uint8

Estimate exposes freq estimate (for metrics/diagnostics).

func (*ShardedAdmitter) Record added in v1.5.0

func (a *ShardedAdmitter) Record(h uint64)

Record observes a key access. We use the doorkeeper to gate noise: first sight -> set bit only. Second (or FP) sight -> increment TinyLFU sketch (approximate frequency).

func (*ShardedAdmitter) Reset added in v1.5.0

func (a *ShardedAdmitter) Reset()

Reset forces aging now (useful for tests or ops hooks). Also resets the doorkeeper.

Jump to

Keyboard shortcuts

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