Registry / database / nodecaf-redis

nodecaf-redis

JSON →
library0.1.0jsnpmunverified

A convenient wrapper around node-redis for use within a Nodecaf application, providing a promise-based async/await interface. Version 0.1.0 is the initial release, currently in development and not yet stable. It relies on the node-redis package and is tightly coupled with the Nodecaf framework. Compared to using node-redis directly, it simplifies configuration and integrates with Nodecaf's lifecycle, but it is not intended for general-purpose Redis access outside of Nodecaf.

npm install nodecaf-redis
INSTALL
IMPORT
SIG · NODECAF-REDIS
N
nodecaf-redis
databasejavascriptv0.1.0
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 redis from 'nodecaf-redis';
✗ const redis = require('nodecaf-redis');
Package is ESM-only; CommonJS require will fail.
NodecafRedis
✓ import { NodecafRedis } from 'nodecaf-redis';
Named export for the class constructor, useful for TypeScript type annotations.
RedisClient
✓ import type { RedisClient } from 'nodecaf-redis';
TypeScript users should import the type for strong typing.

Demonstrates creating a Redis client instance, connecting, setting and getting a value, and disconnecting.

import Redis from 'nodecaf-redis'; const redis = new Redis({ url: process.env.REDIS_URL ?? 'redis://localhost:6379' }); await redis.connect(); await redis.set('key', 'value'); const value = await redis.get('key'); console.log(value); await redis.disconnect();
Debug
Known issues
gotchaThe package is in early development (v0.1.0) and the API may change without notice.
fix
Pin to exact version and test on upgrades.
affects: 0.1.x
gotchaMust be used within a Nodecaf application; standalone usage may lack necessary context.
fix
Ensure your application is built on Nodecaf, or consider using node-redis directly.
affects: >=0.1.0
breakingRequires Node.js >= 14 and ESM support; CJS projects cannot use this package.
fix
Switch to ESM by adding 'type': 'module' to your package.json, or use a different Redis wrapper.
affects: >=0.1.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/nodecaf-redis/src/index.js not supported.
Trying to require an ESM-only package in a CommonJS module.
fix
Use import instead of require(), or convert your project to ESM.
TypeError: Redis is not a constructor
Importing the default export incorrectly (e.g., using named import for default).
fix
Use 'import Redis from 'nodecaf-redis'' (default import).
TypeError: Cannot read properties of undefined (reading 'connect')
Calling redis.connect() before the client is instantiated or after it has been destroyed.
fix
Ensure redis variable is properly initialized with 'new Redis()' and not reassigned.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
redisrequiredThe underlying Redis client library; nodecaf-redis wraps its functionality.
Agent activity
8 hits · last 30 days
node
8
Resources
nodecaf-redis — npm install nodecaf-redis · libregistry