Skip to main content
Module

x/zoic/src/lru.ts>default

A RESTful API-caching middleware library for Oak/Deno
Latest
class default
import { default } from "https://deno.land/x/zoic@v1.0.5/src/lru.ts";

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

Constructors

new
default(
expire: number,
metrics: PerfMetrics,
capacity: number,
)

Properties

cache: Record<string, Node>
capacity: number
expire: number
length: number
metrics: 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.