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

@zeruxjs/cache-redis

v0.0.3

Published

Redis cache helper supporting node-redis and ioredis, with BullMQ connection settings.

Readme

@zeruxjs/cache-redis

Redis 5 adapter for @zeruxjs/cache. Redis client loading is optional when passing an injected client; normal usage requires the redis dependency declared by this package.

import { createCacheManager } from '@zeruxjs/cache';
const cache = await createCacheManager({
  helper: '@zeruxjs/cache-redis', prefix: 'shop',
  options: {url: 'redis://127.0.0.1:6379'}
});
await cache.set('product:1', {stock: 5}, {ttlSeconds: 30});
await cache.clear(); // SCAN + DEL only keys with literal prefix `shop:`

Operational safety

FLUSHDB is disabled by default. Without a namespace, .clear() rejects rather than destroying unrelated Redis data. Explicitly set allowFlushDb: true only when using a dedicated Redis database.

Namespace deletes scan keys and issue bounded DEL batches (not a snapshot transaction); concurrent writes can race with clearing. The prefix is treated literally even if it contains Redis glob metacharacters.

The adapter supports JSON values, mGet/mSet, key TTLs, Redis atomic integer increments/decrements, conditional SET NX/XX, and an injected client. Integer counters share Redis's native integer representation. Writing a string to a counter key and then incrementing it raises a Redis error.

import { createRedisCacheHelper } from '@zeruxjs/cache-redis';
const helper = createRedisCacheHelper(existingRedisClient, {allowFlushDb:false});

Injected clients are not closed by default (ownClient: true opts in). The factory opens and owns a client only when it creates one. For production, use Redis TLS/ACLs, timeouts, dedicated credentials, and secure network access.

ioredis and BullMQ integration (Section 52)

The default remains redis (node-redis). Select {driver:'ioredis'} for ioredis v5, or inject an existing ioredis instance. Injected clients remain caller-owned unless ownClient:true.

import {createCacheHelper, createBullMQRedisOptions} from '@zeruxjs/cache-redis';
const cache=await createCacheHelper({driver:'ioredis',url:process.env.REDIS_URL});
const {producer,worker}=createBullMQRedisOptions({url:process.env.REDIS_URL});
// BullMQ manages its connections separately; the queue uses these option policies.

The ioredis adapter translates its lowercase mget, mset, incrby, scan, and quit commands. It preserves the existing safe cache namespace clearing and the default FLUSHDB prohibition. Do not use ioredis keyPrefix in BullMQ connections. Separate cache prefixes (cache) from BullMQ prefixes (bull). Unhandled Redis errors can take down Node processes; both factories register Redis error listeners, while the queue's worker error hook is optional. Existing redis driver users do not need to migrate.

Section 75 — shared Redis Cluster and tenant isolation

createIORedisCacheHelper(clusterClient, {ownClient:false}) accepts an already configured ioredis Cluster client. It scans each master shard when clearing a literal namespace. Keys are verified against namespace + ':' even if SCAN returns overmatching keys, and deletes are one key at a time (no cross-slot DEL). getMany/setMany on an injected Cluster use per-key operations; multi-key updates are not atomic across slots. Standalone Redis behavior is unchanged. A cluster's FLUSHDB is deliberately unavailable even if allowFlushDb:true; always use application-prefix clearing. This is a non-snapshot sweep: callers must quiesce writers to guarantee the namespace remains empty. Redis ACLs and credential-bound tenant isolation remain deployment responsibilities.

For BullMQ Redis Cluster, use createBullMQRedisClusterConnections indirectly through @zeruxjs/queue as described in its README; the standalone createBullMQRedisOptions() intentionally rejects cluster configuration. Always use dedicated test Redis servers and different prefixes per tenant. No live Redis/Cluster certification is claimed until the opt-in integration tests are run.

Release 0.0.2

Prepared to validate npm trusted publishing through GitHub Actions.

Release 0.0.3

Synchronized ecosystem release, including Zuixs CSS-entry support and documentation updates. Existing placeholder packages retain their documented limitations.