Skip to main content
Module

x/cache_mapset/lifo.ts>LIFOMap

Maps and Sets with cache replacement policies, TC39 proposal-policy-map-set implementation
Latest
class LIFOMap
extends BaseMap<K, V>
import { LIFOMap } from "https://deno.land/x/cache_mapset@1.0.0/lifo.ts";

Map with an upper limit, objects like. When the upper limit is reached, replaces the entry with LIFO algorithm.

Examples

Example 1

import { LIFOMap } from "https://deno.land/x/cache_mapset@$VERSION/lifo.ts";

declare const maxNumOfEntries: number;
const map = new LIFOMap(maxNumOfEntries);

Constructors

new
LIFOMap(maxNumOfEntries: number, entries?: Readonly<Iterable<readonly [K, V]>>)

Methods

get(key: K): V | undefined
set(key: K, value: V): this