Node.js library that integrates MySQL with Redis caching for automatic query caching, auto key generation, auto cache invalidation, and transparent fallback during Redis outages. Version 2.8.0. Uses mysql2 connection pool with automatic reconnection, redis ioredis with exponential backoff, and supports transactions, pagination, bulk inserts, and query timeouts. Differentiators: zero-config setup via environment variables, production-grade resilience tested against 18 chaos scenarios (Redis/MySQL kills, network partitions, thundering herd), cluster-safe cache invalidation using SCAN, and TypeScript type definitions included. The library degrades gracefully: reads return empty arrays and writes proceed without caching when Redis is down; no unhandled errors or crashes. Suitable for e-commerce, multi-tenant SaaS, real-time apps, and bulk operations.
npm install node-caching-mysql-connector-with-redisNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: cached read, write with auto invalidation, transaction, health check, and graceful shutdown. Requires .env variables set.
Use exactly 'QuaryCache' when destructuring; do not expect 'queryCache' or 'QueryCache'.
Use require() instead of import. If using TypeScript, set "esModuleInterop": true and use import syntax that compiles to require().
Upgrade to v2.8.0 and refactor to use getCacheQuery for reads and QuaryCache for writes.
Use dotenv.config() early in your application entry point and ensure required vars are present: DB_HOST, DB_USERNAME, DB_NAME, REDIS_SERVER.
Set CORE_AUTO_FEATURES=true in .env; future versions may remove this variable entirely.
Run: npm install mysql2
Run: npm install ioredis
Use const { QuaryCache } = require('node-caching-mysql-connector-with-redis') — not import syntax.Start Redis server: redis-server, or set REDIS_SERVER and REDIS_PORT in .env.
Ensure MySQL is running and DB_HOST is correct. Use 127.0.0.1 instead of localhost if DNS issues.