A promise-based caching library built on top of ioredis for Node.js applications. Version 2.0.3 wraps ioredis to provide a compact, memory-efficient caching interface using Redis hashes. Supports standard cache, hash cache, batch operations, TTL expiration, pattern-based deletion, and atomic acquire operations. Ships TypeScript types. Release cadence is low; maintainer activity has been minimal since late 2023. Differentiators: promise-based API, hash map storage for memory efficiency, and built-in `manyCache` to batch uncached keys.
npm install ioredis-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic cache, retrieving, and deleting a cached value with TTL, using TypeScript.
Always pass a configured ioredis instance or an object with `redis` property set to an ioredis instance.
Create an ioredis instance first: `new Redis('redis://...')` then pass to constructor.Use ES module import syntax: `import Cache from 'ioredis-cache'`.
Ensure the callback returns a non-undefined value if caching is desired.
Specify TTL as number of seconds (e.g., 3600 for one hour).
Directly call `redis.quit()` on the ioredis instance you created.
Use `new Cache(redis)` instead of `Cache(redis)`.
Start Redis server or provide correct connection options to ioredis.
Import ioredis: `import Redis from 'ioredis'` or `const Redis = require('ioredis')`.