Promise-based async cache that deduplicates concurrent lookups by caching the promise itself rather than the resolved value. Version 1.0.3 is stable with no recent updates (last published 2017). It wraps lru-cache to provide a simple API for caching async operations, including stale value support and automatic background refresh. Key differentiators: lightweight, no dependencies beyond lru-cache, and supports sync/async load functions.
npm install p-async-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a PAC instance with an async load function, gets the same key twice, and shows counter remains 1 on second call.
Use `import PAC from 'p-async-cache'`.
Use `const PAC = require('p-async-cache').default`.Pin `lru-cache` to version 4.x in your dependencies.
Use `await cache.get(key)` and access `.value`.
Use `import PAC from 'p-async-cache'` or `const PAC = require('p-async-cache').default`Run `npm install p-async-cache`
Add `await` before `cache.get(params)`