An asynchronous function memoizer for Node.js using Redis as a shared cache store, with configurable TTL. Version 1.0.2 (stable) works with promises and async/await on Node 8+. It provides a drop-in caching layer for heavy async functions, with cache shared across processes via Redis. Differentiators: network-available cache, TTL-based expiration, and support for both async/await and promises. Compared to other memoizers, it uses an external Redis store, making it suitable for distributed systems.
npm install redis-memoizerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows initializing with Redis client, memoizing an async function, and measuring performance improvement on cached call.
Ensure options.name is a string.
Use async/await or promises. For callbacks, use v0.x.
Attach error handler to Redis client: redisClient.on('error', err => console.error(err)).Use a shorter TTL or invalidate cache manually if strict freshness is needed.
Use default import: import memoize from 'redis-memoizer' or const memoize = require('redis-memoizer').Add name property to options object: memoize(fn, { name: 'myFunction' }).Wrap callback in a promise or use async/await.