policy

package
v0.0.0-...-4706bde Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

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

type LFU

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

func NewLFU

func NewLFU() *LFU

func (*LFU) Add

func (l *LFU) Add(key string)

func (*LFU) Delete

func (l *LFU) Delete(key string)

func (*LFU) Evict

func (l *LFU) Evict() (evicted string)

func (*LFU) Refresh

func (l *LFU) Refresh(key string)

type LRU

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

func NewLRU

func NewLRU() *LRU

func (*LRU) Add

func (l *LRU) Add(key string)

Add a new element to the eviction structure

func (*LRU) Delete

func (l *LRU) Delete(key string)

Delete removes an element from the list. Note that this is done efficiently with the Go standard list package.

func (*LRU) Evict

func (l *LRU) Evict() (evicted string)

func (*LRU) Refresh

func (l *LRU) Refresh(key string)

Refresh refreshes an existing element which was already seen by the policy

type PriorityQueue

type PriorityQueue []*Item

A PriorityQueue implements heap.Interface and holds Items.

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() any

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x any)

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

func (*PriorityQueue) Update

func (pq *PriorityQueue) Update(item *Item, priority int)

Update modifies the priority and value of an Item in the queue.

Jump to

Keyboard shortcuts

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