Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/cache_mapset/fifo.ts>FIFOMap

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

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

Examples

Example 1

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

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

Constructors

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

Methods

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