Timer Wheel
![Dependencies](https://david-dm.org/aholstenson/timer-wheel.svg)
timer-wheel
is a JavaScript library for efficiently managing a large amount
of timed actions. It allows you to schedule actions after a certain delay and
then control when to advance and run actions where the delay has passed.
This implementation is designed for larger delays and has a minimum delay of
1000 ms.
import { TimerWheel } from 'timer-wheel';
const wheel = new TimerWheel();
wheel.schedule(() => {
console.log('Action invoked');
}, 1500 )
setInterval(() => {
wheel.advance();
}, 1000);
This library is useful for things like expiring caches with lazy expiration,
instead of checking if every cache item should be expired use a wheel to queue
removal actions and call advance
before every get/set. This is how
Transitory implements expiring
caches.