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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@igniter-js/adapter-redis

v0.2.1

Published

[![NPM Version](https://img.shields.io/npm/v/@igniter-js/adapter-redis.svg)](https://www.npmjs.com/package/@igniter-js/adapter-redis) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Readme

@igniter-js/adapter-redis

NPM Version License: MIT

The official Redis adapter for the Igniter.js Store system. This package provides a high-performance driver for caching and pub/sub messaging using a Redis data store.

Role in the Ecosystem

This adapter acts as the concrete implementation for the abstract Store interface defined in @igniter-js/core. By plugging this adapter into your application, you enable powerful features:

  • Caching: A fast, Redis-backed key-value cache for storing the results of expensive operations.
  • Pub/Sub: A message bus for building real-time, event-driven features.
  • Shared Connection: The Redis client from this adapter can be shared with other systems, like the Igniter.js Queues (BullMQ) adapter, for maximum efficiency.

Installation

To use this adapter, you need to install it along with its peer dependency, ioredis.

# npm
npm install @igniter-js/adapter-redis ioredis

# yarn
yarn add @igniter-js/adapter-redis ioredis

# pnpm
pnpm add @igniter-js/adapter-redis ioredis

# bun
bun add @igniter-js/adapter-redis ioredis

Basic Usage

The primary export of this package is the createRedisStoreAdapter factory function.

1. Create the Adapter Instance

First, create an instance of the ioredis client and pass it to the adapter factory. This is typically done in a dedicated service file.

// src/services/store.ts
import { createRedisStoreAdapter } from '@igniter-js/adapter-redis';
import { Redis } from 'ioredis';

// It's recommended to configure your Redis connection via environment variables.
const redis = new Redis(process.env.REDIS_URL);

/**
 * The Store adapter for data persistence and messaging.
 */
export const store = createRedisStoreAdapter({
  client: redis,
  // Optional: A global prefix for all keys stored by this adapter.
  keyPrefix: 'igniter-app:',
});

2. Register with the Igniter Builder

Next, enable the Store feature in your main igniter.ts file by passing your store adapter instance to the .store() method on the builder.

// src/igniter.ts
import { Igniter } from '@igniter-js/core';
import { store } from './services/store';

export const igniter = Igniter
  .context<AppContext>()
  .store(store) // Enable the Store feature
  .create();

Your application is now configured to use Redis for caching and pub/sub. You can access the store's methods via igniter.store or context.store within your actions.

Example of use in an action:

handler: async ({ context, response }) => {
  // Set a value in the cache with a 1-hour TTL
  await context.store.set('user:123', { name: 'John Doe' }, { ttl: 3600 });

  // Get the value
  const user = await context.store.get('user:123');

  return response.success({ user });
}

For more detailed guides, please refer to the Official Igniter.js Wiki.

Contributing

Contributions are welcome! Please see the main CONTRIBUTING.md file for details on how to get started.

License

This package is licensed under the MIT License.