Efficient JavaScript cache implementation for Node.js that supports asynchronous reading and writing, prevents duplicate work via cache entry holds, and provides out-of-box in-memory and disk-based cache stores. Version 2.0.5 is current. It solves concurrency challenges with asynchronous cache stores and allows custom stores (e.g., Redis, memcached). Key differentiators: hold mechanism to avoid rebuilding same key, configurable time-to-live and time-to-idle, and support for combined file or separate files disk stores.
npm install raptor-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a disk-backed cache with TTL and idle settings, then retrieves a value with a builder function.
Ensure the configured directory exists before creating the cache or use the 'autoCreate' option (if available).
Use named imports: import { createCache } from 'raptor-cache' or use require('raptor-cache').createCache.Replace createMemoryCache(options) with createCache({ store: 'memory', ...options }).Ensure builder functions always return a truthy value or use a sentinel.
If in CommonJS: const raptorCache = require('raptor-cache'); const createCache = raptorCache.createCache;Create the directory manually before initializing the cache, or use a different store like 'memory'.
Check if the cache is dirty via cache.isDirty() before calling flush().
No dependency data recorded yet.