A transparent Redis caching layer plugin for Payload CMS v3 (currently version 0.2.17, early development). It automatically caches database read queries (find, findOne, count) and invalidates them on writes (create, update, delete). Requires Payload ^3.37.0, Node.js 18.20.2+/20.9.0+, and ioredis. Supports per-collection/global configuration, custom TTL, debug logging, and custom cache key generation. Key differentiator: zero breaking changes integration with existing Payload apps and smart invalidation on write operations.
npm install payloadcms-redis-pluginNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up Payload CMS v3 with the Redis plugin, caching posts and articles collection queries with custom TTLs.
Upgrade Payload to >=3.37.0 or use an older version of this plugin (if exists).
Use `redis.url` instead of `redis.client` if possible.
Ensure TTL is specified in seconds (e.g., 3600 for 1 hour).
Explicitly set `collections: { sensitiveCollection: false }` or `{ skip: true }`.Keep cache keys short; use a hash or include only essential parts of the query.
Use import { redisCache } from 'payloadcms-redis-plugin'; ensure package.json has "type": "module" or use .mjs extension.Ensure Payload buildConfig includes a valid database adapter (e.g., postgresAdapter).
Add `redis: { url: 'redis://localhost:6379' }` or `redis: { client: new Redis() }` to the plugin config.Check that collections is defined in plugin config or use optional chaining: config.collections?.posts.