Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 1.52 KB

File metadata and controls

41 lines (29 loc) · 1.52 KB

GitHub package.json version npm bundle size GitHub Workflow Status NPM

lup-expires

Offers different data structures that allow temporary storing of objects. Expire time can be defined for stored entries after which they will get automatically deleted.

This package is deprecated. Please use lup-structures instead which includes all features of lup-expires and more.

JavaScript Example

const { ExpireMap } = require("lup-expires);

const map = new ExpireMap({
    defaultExpire: 1000, // Default expire time in milliseconds.
    extendLifespanOnTouch: false, // If true, the lifespan of the entry will be extended on every access of that element.
});
map.set("key1", "value1"); // Will expire in 1000ms
map.set("key2", "value2", 2000); // Will expire in 2000ms

TypeScript Example

import { ExpireMap } from "lup-expires"

const map = new ExpireMap<string, string>({
    defaultExpire: 1000, // Default expire time in milliseconds.
    extendLifespanOnTouch: false, // If true, the lifespan of the entry will be extended on every access of that element.
});
map.set("key1", "value1"); // Will expire in 1000ms
map.set("key2", "value2", 2000); // Will expire in 2000ms