An advanced cache layer for NoSQL databases (v1.1.5, last updated ~2020). Vendor-agnostic with adapters for Google Datastore and potentially others. Uses node-cache-manager for multiple store support (e.g., LRU memory, Redis). Provides automatic read-through caching, write-through invalidation, and optional client wrapping for transparent cache management. Distinguishes itself by supporting auto-invalidation based on entity Kind when used with Redis sets. Requires Node >=6.0. Low maintenance cadence; last release was 2019. Not compatible with modern module systems (CJS only).
npm install nsql-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Setup Google Datastore with nsql-cache, save and retrieve an entity, and run a query. Demonstrates auto-caching with default TTLs.
Consider migrating to alternative caching libraries like ioredis or datastore-cache.
Configure ttl.queries to a higher value (e.g., 600 seconds) in the NsqlCache constructor config.
Set wrapClient: true (default) or manually call cache.del() after save/delete operations.
Test on your Node version; consider using --openssl-legacy-provider if needed.
Run: npm install nsql-cache-datastore
Ensure you use `const NsqlCache = require('nsql-cache');` and create instance with `new NsqlCache({db})`.Ensure TTL values are positive integers (seconds). Example: `ttl: { keys: 600, queries: 300 }`