Registry / storage / distribucache-redis-store

distribucache-redis-store

JSON →
library6.0.2jsnpmunverified

A Redis-backed store implementation for Distribucache, an auto-repopulating cache library. Version 6.0.2 is the latest stable release (as of 2024), with infrequent updates. It wraps ioredis for Redis connectivity and supports keyspace notifications for distributed cache population. Differentiates from generic Redis caches by integrating with Distribucache's stale/populate/pause-populate lifecycle.

npm install distribucache-redis-store
INSTALL
IMPORT
SIG · DISTRIBUCACHE-REDI
D
distribucache-redis-store
storagejavascriptv6.0.2
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.

redisStore
import redisStore from 'distribucache-redis-store'
const redisStore = require('distribucache-redis-store')
Package is ESM-only since v6; use import, not require.
redisStore (CommonJS)
const redisStore = require('distribucache-redis-store').default
const redisStore = require('distribucache-redis-store')
In CommonJS with ESM wrapper, require returns {default}. Use .default to get the function.
redisStore (TypeScript)
import redisStore from 'distribucache-redis-store'
import { redisStore } from 'distribucache-redis-store'
Default export is a function; named export 'redisStore' does not exist.

Shows how to create a Redis-backed Distribucache store, configure it with ioredis options, and set up an auto-repopulating cache with stale/populate timers.

import distribucache from 'distribucache'; import redisStore from 'distribucache-redis-store'; const store = redisStore({ host: 'localhost', port: 6379, namespace: 'myapp', options: { lazyConnect: true } }); const cacheClient = distribucache.createClient(store); const cache = cacheClient.create('users', { staleIn: '10 sec', populateIn: '5 sec', pausePopulateIn: '1 min', populate(key, cb) { // fetch from data source cb(null, { id: key, name: 'Alice' }); } }); // cache.get('123', (err, value) => { ... });
Debug
Known issues
breakingv6 changed to ESM-only; CommonJS require() no longer works without .default
fix
Use import (or require('pkg').default in CJS).
affects: >=6.0.0
deprecatedv5 deprecated passing ioredis instance directly; now config is passed as plain object
fix
Pass config object instead of ioredis instance. ioredis is created internally.
affects: >=5.0.0 <6.0.0
gotchaAWS Elasticache does not allow CONFIG command; keyspace notifications require manual setup
fix
Set `isPreconfigured: true` in config and manually set notify-keyspace-events to 'Kx' in AWS console.
affects: all
gotchaIf not using populateIn, keyspace notifications are unnecessary; omit namespace to avoid warning
fix
Set config.namespace to undefined or omit it if not using populateIn feature.
affects: all
Errors
Common errors & fixes
redisStore is not a function
Default import incorrectly expects named export
fix
Use 'import redisStore from ...' (default import) not 'import { redisStore } from ...'.
distribucache.createClient is not a function
Missing or incorrect store object; redisStore() returns a store object
fix
Ensure redisStore() is called (not just referenced) and passed to createClient.
Error: ERR unknown command 'CONFIG'
Redis server (e.g., AWS) disallows CONFIG; store tries to set keyspace notifications
fix
Set config.isPreconfigured: true and manually configure notify-keyspace-events to 'Kx'.
Upgrade
Version history
6.0.2latest on npm
Audit
Dependencies
ioredisrequiredRedis client for connection and commands
Agent activity
28 hits · last 30 days
node
26
OpenAI (training)
1
Resources
distribucache-redis-store — npm install distribucache-redis-store · libregistry