Mongoose store for node-cache-manager that uses an existing Mongoose connection to cache data in MongoDB. Version 1.0.1 is stable, with infrequent releases. Key differentiators: allows custom Mongoose models, supports TTL-based expiration via MongoDB TTL index, and lets you reuse existing connections instead of creating a new one. Compared to other MongoDB cache stores, it integrates tightly with Mongoose schemas.
npm install cache-manager-mongooseNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: connect Mongoose, create a cache manager with mongoose store, set/get/delete a value.
Pass mongoose: require('mongoose') or your existing connection instance to the caching options.Pass connection: yourConnectionObject in addition to mongoose: mongoose to the caching options.
Use a very large TTL or set 'ttl' option to Infinity/null if supported by cache-manager.
Ensure options passed to cacheManager.caching include mongoose: require('mongoose')Provide a unique modelName option to each cache instance, e.g., modelName: 'MyCache'
Check package is installed and required as const mongooseStore = require('cache-manager-mongoose'); (not destructured)