Skip to content

Commit 7d3dc84

Browse files
committed
Extended ExpireMap, updated documentation
1 parent 9e06434 commit 7d3dc84

6 files changed

Lines changed: 2834 additions & 2917 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ Expire time can be defined for stored entries after which they will get automati
1212
```javascript
1313
const { ExpireMap } = require("lup-expires);
1414
15+
const map = new ExpireMap({
16+
defaultExpire: 1000, // Default expire time in milliseconds.
17+
extendLifespanOnTouch: false, // If true, the lifespan of the entry will be extended on every access of that element.
18+
});
19+
map.set("key1", "value1"); // Will expire in 1000ms
20+
map.set("key2", "value2", 2000); // Will expire in 2000ms
1521
1622
```
1723
@@ -21,5 +27,11 @@ const { ExpireMap } = require("lup-expires);
2127
```typescript
2228
import { ExpireMap } from "lup-expires"
2329
30+
const map = new ExpireMap<string, string>({
31+
defaultExpire: 1000, // Default expire time in milliseconds.
32+
extendLifespanOnTouch: false, // If true, the lifespan of the entry will be extended on every access of that element.
33+
});
34+
map.set("key1", "value1"); // Will expire in 1000ms
35+
map.set("key2", "value2", 2000); // Will expire in 2000ms
2436
2537
```

0 commit comments

Comments
 (0)