A zero-dependency Koa router cache middleware (v3.8.8, stable). Provides in-memory and optional Redis-based caching with route-specific timeout configuration, increasing cache timeout based on request frequency, and customizable cache key fragments from headers or query parameters. Key differentiators: no dependencies, simple API with configure/middleware/clear, support for cluster environments, and fine-grained cache key control.
npm install koa-cache-liteNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up in-memory caching for /api/v1/test with a 3-second timeout and debug logging.
Migrate to cache.configure(routes, options). Routes is an object mapping URL patterns to timeouts, options includes debug, external, increasing, etc.
Use app.use(cache.middleware())
npm install ioredis
Pass routes object directly: cache.configure({ '/url': timeout }, options)Set options.keyFragment to the header name that contains the cache key fragment.
Use cache.init() in master and pass wrapped middleware to workers.
Use const Koa = require('koa'); const app = new Koa(); app.use(cache.middleware());npm install ioredis
Use const cache = require('koa-cache-lite'); app.use(cache.middleware());