Cache Tags is an npm library (v2.9.1) that adds cache tagging for bulk invalidation, supporting Redis (single node and cluster) as the backend. It wraps the ioredis client to allow associating cache entries with tags, enabling listing entries by tag and invalidating all entries for a tag atomically. Inspired by Drupal 8 and Laravel cache tags, it has a low release cadence and is tested against Redis clusters. Key differentiators include simple tag-based get/set/invalidation and listing operations.
npm install cache-tagsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates set/get with tags, listing entries by tag, and invalidation of all entries for a tag.
Install and run Redis before using the library.
Pass connection options (string or object) as constructor argument.
Re-enter tagged mode via redis.tags() after each invalidate() call.
Be aware that invalidation is tag-based, not TTL-based.
Start Redis: `redis-server` (or verify host/port).
Ensure you used `const { TaggableCache: Redis } = require('cache-tags');` and not `const Redis = require('ioredis');`.Use `.tags(['my-tag']).set(key, value, ttl)` – note the array of tags, not a string.