Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/velo/mod.ts>Lfu

A high-performance caching library for Deno. Supports LRU, LFU, ARC, and TinyLFU.
Latest
class Lfu
implements Policy<K, V>
import { Lfu } from "https://deno.land/x/velo@1.0.0/mod.ts";

Least Frequently Used (LFU)

Constructors

new
Lfu(capacity: number)

Type Parameters

K extends Key
V

Properties

private
_keys: [key in Key]: Node<K, V>
private
_size: number
private
frequency: { [key: number]: DoublyLinkedList<K, V>; }
private
minFrequency: number
readonly
capacity: number
readonly
keys
optional
onEvict: RemoveListener<K, V>
readonly
size
readonly
values

Methods

forEach(callback: (item: { key: K; value: V; }, index: number) => void)
get(key: K)
has(key: K)
peek(key: K)
remove(key: K)
set(key: K, value: V)