Registry / database / hemera-redis-cache

hemera-redis-cache

JSON →
library5.0.0jsnpmunverified

A plugin that integrates Redis as a caching layer for Hemera microservices, using the Node Redis driver. Version 5.0.0 is the current stable release. It requires hemera-joi for validation and is part of the Hemera ecosystem. Designed for microservice caching with NATS messaging; last updated several years ago (maintenance mode).

npm install hemera-redis-cache
INSTALL
IMPORT
SIG · HEMERA-REDIS-CACHE
H
hemera-redis-cache
databasejavascriptv5.0.0
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.

hemera-redis-cache
const hemeraRedisCache = require('hemera-redis-cache')
import hemeraRedisCache from 'hemera-redis-cache'
CommonJS only; no ESM support.
plugin
hemera.use(require('hemera-redis-cache'))
hemera.use(hemeraRedisCache())
Pass the require result directly, not a function call.
options
hemera.use(require('hemera-redis-cache'), { ttl: 300 })
hemera.use(require('hemera-redis-cache'), { ttl: '300' })
ttl must be a number, not string.

Shows how to instantiate Hemera with NATS and add the Redis cache plugin.

const Hemera = require('nats-hemera') const nats = require('nats').connect() const hemera = new Hemera(nats) hemera.use(require('hemera-joi')) hemera.use(require('hemera-redis-cache')) hemera.ready(() => { console.log('Hemera with Redis cache is ready') })
Debug
Known issues
breakingDropped support for Node.js versions < 8.0.0.
fix
Upgrade Node.js to 8.0.0 or newer.
affects: >=5.0.0
gotchahemera-joi must be loaded before hemera-redis-cache.
fix
Ensure hemera.use(require('hemera-joi')) is called before hemera-redis-cache.
affects: >=4.0.0
deprecatedThe plugin is no longer actively maintained; use at your own risk.
fix
Consider forking or migrating to alternative caching solutions.
affects: >=5.0.0
Errors
Common errors & fixes
Error: Cannot find module 'hemera-joi'
Missing peer dependency hemera-joi.
fix
Run: npm install hemera-joi
Error: Redis connection to 127.0.0.1:6379 failed
Redis server not running or unreachable.
fix
Start Redis: redis-server or docker-compose up (see README).
TypeError: hemera.use is not a function
hemera instance not initialized correctly.
fix
Ensure you created hemera with new Hemera(nats) and have NATS connection.
Upgrade
Version history
5.0.0latest on npm
Audit
Dependencies
hemera-joirequiredRequired for Joi validation in plugin configuration
Agent activity
36 hits · last 30 days
node
32
Resources
hemera-redis-cache — npm install hemera-redis-cache · libregistry