A lightweight in-memory cache with async value retrieval, deduplication of concurrent requests, and TTL support. Version 1.1.1 is the latest stable release. Published by Logz.io, it provides a simple API to cache asynchronous results, ensuring that multiple calls for the same key during ongoing retrieval will wait for the same promise, avoiding redundant executions. Unlike more feature-rich caches (e.g., node-cache or lru-cache), it focuses on simplicity and async-first design.
npm install memory-cacherNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage: caching async result with TTL and retrieving from cache synchronously.
Check for null or use optional chaining.
Ensure you pass TTL in milliseconds.
Consider alternative modern caches like lru-cache or async-cache-dedupe for TypeScript projects.
Use const MemoryCacher = require('memory-cacher'); for CommonJS or import MemoryCacher from 'memory-cacher'; for ESM.Call getCached with a key that was previously cached or provide a function to compute the value.
No dependency data recorded yet.