{"repo":"ilovepixelart/ts-cache-mongoose","free":true,"listed":false,"github":"https://github.com/ilovepixelart/ts-cache-mongoose","clone":"git clone https://github.com/ilovepixelart/ts-cache-mongoose.git","description":"Cache plugin for mongoose Queries and Aggregate (in-memory, redis)","language":"TypeScript","stars":34,"topics":["aggregate","backend","cache","db","memory","mongdodb","mongo","mongoose","nosql","plugin"],"license":"MIT","category":"databases-storage","readme_excerpt":"ts-cache-mongoose Cache query and aggregate in mongoose using in-memory or redis \\ \\ \\ Motivation ts-cache-mongoose is a plugin for mongoose \\ I need a way to cache mongoose queries and aggregations to improve application performance. It should support both in-memory and Redis cache engines, work with all major Node.js frameworks, and be easy to use with a simple .cache() method on queries and aggregations. Supports and tested with CI tests against mongoose 6.12.2 , 7.6.4 , 8.23.0 , and 9.4.1 . Features - In-memory caching - Redis caching - Cache expiration - Cache invalidation - Cache key generation - Cache key prefix - Query caching - Aggregate caching - Supports ESM and CommonJS Installation mongoose is a peer dependency — install it alongside ts-cache-mongoose . Example Works with any Node.js framework — Express, Fastify, Koa, Hono, etc: Query caching Aggregate caching Bounded in-memory cache The in-memory engine is unbounded by default. For workloads where query keys are driven by user input (search, filters, pagination), cap the cache so a caller generating unique cache keys cannot grow the map without limit. Two bounds are available and can be combined — eviction is LRU, and whichever bound is hit first triggers it: maxBytes measures entry size via node:v8.serialize(value).byteLength by default — handles circular references (mongoose populate parent-refs), single C++ call per set , works on Node / Bun / Deno. Provide your own sizeCalculation callback if you want an O(1","default_branch":null,"files":null,"tree":[],"storefront":"/r/ilovepixelart","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ilovepixelart/ts-cache-mongoose/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}