Registry / database / redis-enhanced

redis-enhanced

JSON →
library1.0.1jsnpmunverified

A TypeScript-first Redis client built on redis-om that adds advanced persistence management (RDB, AOF) and transaction support with entity versioning. Current version 1.0.1 provides simplified Redis interactions with robust error handling, configurable save strategies, and atomic transaction lifecycle management. It differentiates from raw redis-om by offering a higher-level API for persistence configuration and transaction rollback, and from node-redis by focusing on entity management and persistence patterns for applications needing durable Redis storage.

npm install redis-enhanced
INSTALL
IMPORT
SIG · REDIS-ENHANCED
R
redis-enhanced
databasejavascriptv1.0.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.

EnhancedRedisClient
✓ import { EnhancedRedisClient } from 'redis-enhanced'
✗ const EnhancedRedisClient = require('redis-enhanced').EnhancedRedisClient
ESM default export not available; named import only. CJS require must access the property.
PersistenceType
✓ import { PersistenceType } from 'redis-enhanced'
✗ import PersistenceType from 'redis-enhanced'
Enum is a named export, not default export.
TransactionManager
✓ import { TransactionManager } from 'redis-enhanced'
TransactionManager is a class exported as a named export. Types are included.

Demonstrates connecting to Redis, setting RDB persistence, and performing a transactional save with rollback.

import { EnhancedRedisClient, PersistenceType } from 'redis-enhanced'; async function main() { const client = new EnhancedRedisClient({ url: 'redis://localhost:6379', password: process.env.REDIS_PASSWORD ?? '', }); await client.connect(); // Configure RDB persistence const persistenceManager = client.getPersistenceManager(); await persistenceManager.setPersistence({ type: PersistenceType.RDB, rdbOptions: { saveFrequency: 3600 }, }); // Basic transaction const transactionManager = client.getTransactionManager(); await transactionManager.beginTransaction(); try { const user = await transactionManager.save({ name: 'Alice', email: 'alice@example.com' }); console.log('Saved user:', user); await transactionManager.commitTransaction(); } catch (err) { await transactionManager.rollbackTransaction(); } await client.quit(); } main().catch(console.error);
Debug
Known issues
breakingRedis server version must be >= 6.0 for redis-om compatibility
fix
Upgrade Redis server to version 6.0 or higher.
affects: >=0.0.0
gotchaEnhancedRedisClient instances are not reentrant; do not call connect() multiple times
fix
Call connect() once and reuse the same client instance.
affects: >=0.0.0
deprecatedThe `password` config option is deprecated; use `username` and `password` via ACL or leave empty for default user
fix
Remove password field if using default user; otherwise set username/password in url like `redis://user:pass@localhost:6379`.
affects: >=0.0.0
gotchaTransactionManager relies on entity versioning (__v field); manually editing that field will break optimistic concurrency
fix
Do not modify the __v key directly. Let the library manage versions.
affects: >=0.0.0
breakingThe `flushDb()` method will flush all keys; it does not support flushing specific namespaces
fix
Ensure you are on the correct redis database before calling flushDb(). Use SELECT or separate client instances for different namespaces.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: EnhancedRedisClient is not a constructor
Attempting to use default import: `import EnhancedRedisClient from 'redis-enhanced'`
fix
Use named import: `import { EnhancedRedisClient } from 'redis-enhanced'`
Error: Redis connection refused at localhost:6379
Redis server is not running or not accessible
fix
Start Redis server with `redis-server` or adjust the url configuration.
TypeError: Cannot read properties of undefined (reading 'getPersistenceManager')
Calling getPersistenceManager() before connect() finishes
fix
Await client.connect() before using any manager methods.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
redis-omrequiredCore library providing Redis OM functionality (schema, entity management, querying)
redisrequiredRedis client driver used for database connectivity; peer dependency of redis-om
Agent activity
13 hits · last 30 days
node
10
Meta
1
Resources
redis-enhanced — npm install redis-enhanced · libregistry