npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

redis-enhanced

v1.0.1

Published

Advanced Redis client with persistence and transaction support built on redis-om

Downloads

3

Readme

Redis Enhanced

A powerful, TypeScript-first Redis client with advanced persistence and transaction management built on top of redis-om.

🌟 Features

  • Enhanced Redis Client: Simplified Redis interactions with robust error handling
  • Persistence Management:
    • RDB (Redis Database) Persistence
    • AOF (Append Only File) Persistence
    • Configurable save strategies
  • Transaction Support:
    • Atomic operations
    • Entity versioning
    • Comprehensive transaction lifecycle management
  • TypeScript First:
    • Strong typing
    • Comprehensive type definitions
    • Easy integration with TypeScript projects

📦 Installation

Install the package using npm:

npm install redis-enhanced

🚀 Quick Start

Basic Connection

import { EnhancedRedisClient } from 'redis-enhanced';

// Create a client with connection details
const client = new EnhancedRedisClient({
  url: 'redis://localhost:6379',
  password: 'your_password'
});

// Connect to Redis
await client.connect();

🔧 Configuration

Redis Configuration

interface RedisConfig {
  url: string;       // Redis connection URL
  username?: string; // Optional username
  password?: string; // Optional password
  db?: number;       // Optional database number
}

Persistence Configuration

enum PersistenceType {
  NONE = 'NONE',  // No persistence
  RDB = 'RDB',    // Redis Database persistence
  AOF = 'AOF'     // Append Only File persistence
}

interface PersistenceConfig {
  type: PersistenceType;
  rdbOptions?: {
    saveFrequency: number; // Save interval in seconds
  };
  aofOptions?: {
    appendfsync: 'always' | 'everysec' | 'no';
  };
}

📝 Usage Examples

Persistence Management

// Configure RDB Persistence
const persistenceManager = client.getPersistenceManager();
await persistenceManager.setPersistence({
  type: PersistenceType.RDB,
  rdbOptions: {
    saveFrequency: 3600 // Save every hour
  }
});

// Check current persistence configuration
const currentConfig = await persistenceManager.getCurrentConfig();

// Check persistence status
const status = await persistenceManager.checkPersistenceStatus();

Transaction Management

// Define an entity interface
interface User extends EntityData {
  name: string;
  email: string;
}

// Get transaction manager
const transactionManager = client.getTransactionManager();

// Save an entity
const savedUser = await transactionManager.save({
  name: 'John Doe',
  email: '[email protected]'
});

// Fetch an entity
const user = await transactionManager.fetch(savedUser.entityId!);

// Remove an entity
await transactionManager.remove(savedUser.entityId!);

Advanced Transactions

// Begin a transaction
await transactionManager.beginTransaction();

try {
  // Perform multiple operations
  const user1 = await transactionManager.save({ name: 'Alice' });
  const user2 = await transactionManager.save({ name: 'Bob' });

  // Commit the transaction
  await transactionManager.commitTransaction();
} catch (error) {
  // Rollback if any operation fails
  await transactionManager.rollbackTransaction();
}

🛠 Server Information and Utilities

// Ping Redis server
const isAlive = await client.ping();

// Get server information
const serverInfo = await client.getServerInfo();

// Flush the entire database
await client.flushDb();

🔒 Error Handling

The library provides comprehensive error handling with typed errors:

  • Connection errors
  • Persistence configuration errors
  • Transaction errors
  • Validation errors

🏗 Development

Setup

# Clone the repository
git clone https://github.com/yourusername/redis-enhanced.git

# Install dependencies
npm install

# Run tests
npm test

Testing

  • Unit Tests: npm run test:unit
  • Integration Tests: npm run test:integration
  • All Tests: npm run test:all

🐳 Docker Support

# Start Redis using Docker Compose
docker-compose up -d redis

# Run tests in Docker
docker-compose run test

📄 License

MIT License

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

💡 Feedback

Found a bug? Have a suggestion? Please open an issue on GitHub.


Feel free to customize the README further based on specific details about your package or additional features you'd like to highlight.