A tag-based Redis caching middleware for Express applications, version 2.2.0. It allows caching of HTTP responses in Redis and invalidating them by tags, supporting static and dynamic tag resolution. Fully typed with TypeScript, it includes context awareness for multi-tenant setups and cross-service cache operations. Released under MIT license with a regular release cadence. Key differentiators: tag-based invalidation over key-based, built-in support for tag index pruning (strict/lazy mode), size guard for cache entries, and options for hard/soft invalidation.
npm install express-tag-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize Redis client, TagCache, and TagcacheMiddleware, then cache a GET route with static tags.
Change invalidate(['tags'], 'my-app') to invalidate(['tags'], { appContext: 'my-app' }).Use import statements or dynamic import() in Node.js with ESM enabled.
Consider using tagIndexMaintenanceMode: 'lazy' for better performance.
Ensure cache() array contains only strings or functions, not a mix of both in the same element.
Use invalidate(['tags'], { appContext: 'my-app' }) instead of invalidate(['tags'], 'my-app').Use import { TagcacheMiddleware } from 'express-tag-cache' instead of import TagcacheMiddleware from 'express-tag-cache'.Switch to import statements or use dynamic import().