s3fifo

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.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 Policy

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

Policy is an eviction policy based on S3-FIFO eviction algorithm from the following paper: https://dl.acm.org/doi/10.1145/3600006.3613147.

func NewPolicy

func NewPolicy[K comparable, V any](maxCost int, evictNode func(node.Node[K, V])) *Policy[K, V]

NewPolicy creates a new Policy.

func (*Policy[K, V]) Add

func (p *Policy[K, V]) Add(n node.Node[K, V])

Add adds node to the eviction policy.

func (*Policy[K, V]) Clear

func (p *Policy[K, V]) Clear()

Clear clears the eviction policy and returns it to the default state.

func (*Policy[K, V]) Delete

func (p *Policy[K, V]) Delete(n node.Node[K, V])

Delete deletes node from the eviction policy.

func (*Policy[K, V]) MaxAvailableCost

func (p *Policy[K, V]) MaxAvailableCost() int

MaxAvailableCost returns the maximum available cost of the node.

func (*Policy[K, V]) Read

func (p *Policy[K, V]) Read(nodes []node.Node[K, V])

Read updates the eviction policy based on node accesses.

Jump to

Keyboard shortcuts

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