A simple TTL-based in-memory cache library for Node.js (v1.1.1, 5+ years old). Provides get/set/del/has/size/clear with optional TTL in milliseconds. Minimal dependencies; no async, no events, no size limits. Slower than `node-cache` or `lru-cache`; primarily a teaching example. Not actively maintained (last commit 2018).
npm install ttl-cache-jsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage: create cache, set key with 60s TTL, get value, wait for expiry, delete key, and check existence.
Convert seconds to ms: set(key, val, seconds * 1000)
Chain with separate calls: cache.set('a', 1); cache.set('b', 2);Use dynamic import() with .mjs wrapper or switch to lru-cache.
Use `const cache = Cache()` without `new`.
Run `npm install ttl-cache-js` and use `require('ttl-cache-js')`.Ensure you call `Cache()` or `new Cache()` to get an instance.
No dependency data recorded yet.