Registry / database / d2c-rcaches

d2c-rcaches

JSON →
library1.4.1jsnpmunverified

A lightweight Redis-based shared caching library for Node.js, version 1.4.1. Provides simple and efficient caching with TTL support, built on top of ioredis. Ships TypeScript types and requires Node 10+. Minimal API surface compared to alternatives like node-cache-manager.

npm install d2c-rcaches
INSTALL
IMPORT
SIG · D2C-RCACHES
D
d2c-rcaches
databasejavascriptv1.4.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import RCaches from 'd2c-rcaches'
✗ const RCaches = require('d2c-rcaches')
Default export; ESM and TypeScript supported.
RCaches
✓ import { RCaches } from 'd2c-rcaches'
✗ import RCaches from 'd2c-rcaches'
Also available as named export for consistency.
CacheOptions
✓ import { CacheOptions } from 'd2c-rcaches'
TypeScript type; exported as type.

Creates a Redis-backed cache instance, sets and retrieves a value with TTL.

import RCaches from 'd2c-rcaches'; import Redis from 'ioredis'; const redis = new Redis({ host: process.env.REDIS_HOST ?? 'localhost', port: Number(process.env.REDIS_PORT ?? 6379) }); const cache = new RCaches(redis, { prefix: 'myapp:', ttl: 60 }); async function main() { await cache.set('user:1', { name: 'Alice' }); const user = await cache.get('user:1'); console.log(user); // { name: 'Alice' } } main().catch(console.error);
Debug
Known issues
gotchaCache keys are prefixed automatically but prefix is optional; no default prefix can lead to key collisions.
fix
Always provide a unique prefix when multiple apps share the same Redis instance.
affects: >=1.0.0
gotchaTTL is in seconds but may be passed as string; ensure numeric values to avoid unintended behavior.
fix
Use numeric TTL values, e.g., ttl: 60.
affects: >=1.0.0
gotchaThe package has not been updated in over 2 years; compatibility with newer Redis or Node versions is untested.
fix
Consider forking or migrating to an actively maintained caching library.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'ioredis'
Missing ioredis peer dependency.
fix
Run: npm install ioredis
TypeError: RCaches is not a constructor
Default import used incorrectly in CommonJS environment.
fix
Use: const RCaches = require('d2c-rcaches').default;
Upgrade
Version history
1.4.1latest on npm
Audit
Dependencies
ioredisrequiredRedis client dependency for cache operations
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
d2c-rcaches — npm install d2c-rcaches · libregistry