Skip to main content
Module

x/velo/src/caches/arc.ts>ARC

Performant Cache implementations for Deno. Supports LRU, LFU, ARC and other caching policies.
Go to Latest
class ARC
extends BaseCache<V>
import { ARC } from "https://deno.land/x/velo@0.1.5/src/caches/arc.ts";

Adaptive Replacement Cache

Constructors

new
ARC(options: Options)

Type Parameters

optional
V = any

Properties

private
b1: ARCList<null>
private
b2: ARCList<null>
private
partition: number
private
t1: ARCList<V>
private
t2: ARCList<V>
readonly
frequentlyEvicted
readonly
frequentlySet
readonly
keys

List of keys in the cache

readonly
recentlyEvicted
readonly
recentlySet
readonly
size

Current number of entries in the cache

readonly
values

List of values in the cache

Methods

private
replace(in_t2: boolean)

Reset the cache

forEach(callback: (item: { key: Key; value: V; }, index: number) => void)

Array like forEach, iterating over all entries in the cache

get(key: Key): V | undefined

Gets the value for a given key

has(key: Key)

Checks if a given key is in the cache

peek(key: Key)

Get the value to a key without manipulating the cache

remove(key: Key)

Removes the cache entry with given key

set(
key: Key,
value: V,
ttl?: number,
)

Inserts a new entry into the cache