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

x/velo/mod.ts>Lru

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

Least Recently Used (LRU)

Constructors

new
Lru(capacity: number)

Type Parameters

K extends Key
V

Properties

private
_keys: Array<K | undefined>
private
_values: Array<V | undefined>
private
items: [key in Key]: number
private
pointers: PointerList
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): V | undefined
has(key: K)
peek(key: K)
remove(key: K)
set(key: K, value: V)