1.0.1 • Published 3 years ago

expiring_map v1.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
3 years ago

Build Status

Install

npm install --save expiring_map

Use

Provide an expiration time, in milliseconds, to the constructor. Expiration times can also be provided for each set call. If there's no expiration time, the entry will never expire.

const ExpiringMap = require('expiring_map').ExpiringMap

let map = new ExpiringMap(3000)
map.set(1, 1)  // will expire after 3 seconds
map.set(2, 2, 1000)  // will expire after 1 second

let map2 = new ExpiringMap()
map2.set(1, 1)  // will never expire