Skip to main content
Module

x/zoic/src/lru.ts>default

A caching middeware library for Deno HTTP framework, Oak.
Go to Latest
class default
import { default } from "https://deno.land/x/zoic@v1.0.2/src/lru.ts";

Cache implementing a "least recently used" eviction policy. O(n) insert, lookup, and deletion time.

Constructors

new
default(
expire: number,
metrics: InstanceType<PerfMetrics>,
capacity: number,
)

Properties

cache: Record<string, InstanceType<Node>>
capacity: number
expire: number
length: number
metrics: InstanceType<PerfMetrics>

Methods

Clears entire cache contents.

delete(key: string)

Removes item from any location in the cache.

get(key: string)

Gets item from cache and moves to head -- most recently used.

put(
key: string,
value: cacheValue,
byteSize: number,
)

Adds new item to cache.