A JavaScript map with entries that expire after a given number of milliseconds.
Based on the work in cavitkeskin/map-expire.
npm install @cityssm/map-expireimport { Cache } from "@cityssm/map-expire";
const cache = new Cache();
cache.set(key, value, expiryMillis);
const value = cache.get(key);set(key, value, expiryMillis)
- If
expiryMillisis falsy or not given, the value will never be expired.
get(key)
- Returns
undefinedif not exists or expired.