A lightweight TypeScript cache library (v3.1.10) with stale-while-revalidate support, meant as a drop-in replacement for Next.js unstable_cache that works in any JavaScript environment. Key differentiators: request deduplication, configurable stale behavior (serve stale or wait), tag-based on-demand revalidation, optional disk persistence. Released under MIT license, actively maintained with regular updates. Ships TypeScript types.
npm install next-quick-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage: create a cached async function with 60-second revalidation and tag, then call it.
Use ESM imports: `import { quick_cache } from 'next-quick-cache'`Explicitly set `serveStale: true` if you want stale data while revalidating, or keep default (true) as per current docs.
Use the same string array (e.g., ['user']) for the same cached function to ensure cache hits.
Enable `persist: true` option for disk caching to share cache across processes.
Always specify `revalidate: <seconds>` to avoid unexpected caching behavior.
Switch to `import { quick_cache } from 'next-quick-cache'` and ensure your project is configured for ESM (e.g., "type": "module" in package.json or use .mjs extension).Use named import: `import { quick_cache } from 'next-quick-cache'`