Registry / storage / redis-extension

redis-extension

JSON →
library2.0.4jsnpmunverified

A Redis client extension for Node.js and browser environments, supporting Redis commands, pub/sub, clustering, and TypeScript types. Current stable version is 2.0.4, with regular updates. It wraps the popular `redis` package and adds features like retry logic, connection pooling, and a simplified API. Key differentiators: promise-based, cluster support, and built-in TypeScript definitions.

npm install redis-extension
INSTALL
IMPORT
SIG · REDIS-EXTENSION
R
redis-extension
storagejavascriptv2.0.4
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.

RedisClient
import { RedisClient } from 'redis-extension'
import RedisClient from 'redis-extension';
Default import is not supported; must use named import.
RedisConfig
import { RedisConfig } from 'redis-extension'
const { RedisConfig } = require('redis-extension');
ESM-only since v2.0.0; CommonJS require throws an error. For TypeScript, import type.
createClient
import { createClient } from 'redis-extension'
import { createRedisClient } from 'redis-extension';
Function is named createClient, not createRedisClient.
RedisClusterClient
import { RedisClusterClient } from 'redis-extension'
import { RedisClient } from 'redis-extension'; // for cluster, use RedisClusterClient
Cluster support requires RedisClusterClient, not RedisClient.

Shows how to create a Redis client, connect, set/get a key, and disconnect using redis-extension with async/await.

import { createClient, RedisClient } from 'redis-extension'; const client = createClient({ url: process.env.REDIS_URL ?? 'redis://localhost:6379', retry: true }); await client.connect(); await client.set('foo', 'bar'); const value = await client.get('foo'); console.log(value); // 'bar' await client.disconnect();
Debug
Known issues
breakingVersion 2.0.0 removed support for callbacks; only promises/async-await are supported.
fix
Migrate callback code to async/await. Remove .then() or .catch() chains.
affects: >=2.0.0
breakingImport paths changed in v2.0.0; previously `require('redis-extension').RedisClient` is no longer available.
fix
Use import { RedisClient } from 'redis-extension'; for ESM or dynamic import for CommonJS.
affects: >=2.0.0
deprecatedThe `createRedisClient` function is deprecated in favor of `createClient`.
fix
Replace createRedisClient with createClient.
affects: >=1.5.0
gotchaCluster mode requires explicit use of `RedisClusterClient` class; using `RedisClient` with cluster configuration fails silently.
fix
Check if using cluster: import { RedisClusterClient } from 'redis-extension' and instantiate accordingly.
affects: *
gotchaThe `url` option does not support custom Redis port default; if port omitted, it defaults to 6379 even if a different port is standard.
fix
Always specify port in URL, e.g., `redis://localhost:6379`.
affects: *
Errors
Common errors & fixes
ERR The Redis connection has been closed.
Attempting to use client after calling disconnect() or without proper reconnect handling.
fix
Ensure you reconnect: call client.connect() before any commands. Check retry logic configuration.
TypeError: redis_extension_1.RedisClient is not a constructor
Using CommonJS require when the package is ESM-only since v2.0.0.
fix
Switch to import syntax: import { RedisClient } from 'redis-extension'; or use dynamic import() for CommonJS.
Upgrade
Version history
2.0.4latest on npm
Audit
Dependencies
redisrequiredCore Redis client library that redis-extension wraps
Agent activity
28 hits · last 30 days
node
26
Amazon
1
Resources
redis-extension — npm install redis-extension · libregistry