Near realtime expiry handler
queue Structure: { time1: [{key: key1, onExpire: () => {}}, {key: key2, onExpire: () => {}}], time2: [{key: key3, onExpire: () => {}}] }
Kind: global class
Expiry function
Kind: instance property of InMemoryExpirer
Add to expiry queue
Kind: instance method of InMemoryExpirer
Param | Type | Description |
---|---|---|
time | Number |
When to expire |
key | String |
key to store expiry data against |
onExpire | function |
Expiry callback, called when Date.now() ~= time |
Remove specific key from expiry queue
Kind: instance method of InMemoryExpirer
Param | Type | Description |
---|---|---|
time | Number |
Expiry time |
key | String |
key to remove from the expiry queue |
Cleanup - Empty queue & clear expirer timer
Kind: instance method of InMemoryExpirer