npm.io
1.0.1 • Published 5 years ago

expiring_map

Licence
ISC
Version
1.0.1
Deps
0
Size
2 kB
Vulns
0
Weekly
0

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

Keywords