hybrid-cache v1.0.30 is a dual-layer caching library for Node.js that combines an in-memory cache (node-cache) with Redis synchronization, focusing on fastest response for basic commands. It allows adding multiple Redis servers and provides methods like set, get, setex, incrby, and flushall. Compared to alternatives like ioredis or node-cache alone, it offers a simple API for hybrid caching with optional Redis sync. Released as a stable package with monthly updates, it supports callbacks and is suitable for applications needing low-latency reads with Redis persistence.
npm install hybrid-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes hybrid-cache with a local Redis server, sets and retrieves a value.
Use const cache = HybridCache() instead of new HybridCache().
Read docs carefully: waitingTime default is 2 seconds, not milliseconds.
Use callbacks or promisify: const { promisify } = require('util'); const setAsync = promisify(hybridCache.set.bind(hybridCache));Use hybridCache.get/set for unified hybrid behavior; use .Redis or .Mem only when you need to bypass the hybrid layer.
Call HybridCache() without new.
Use const HybridCache = require('hybrid-cache'); const cache = HybridCache();Ensure Redis is running and accessible. Or omit isSyncRedis: true to skip Redis.
Call hybridCache.init() before using other methods.