Redis Cache
Redis-backed query caching layer for Payload v3 that intercepts database adapter read and write operations.
Installation
pnpm add payloadcms-redis-plugin About
This plugin adds a Redis caching layer to Payload v3 by wrapping the existing database adapter. It intercepts read operations like find, findOne, count, findGlobal, countVersions, and findGlobalVersions, checking Redis before the database and storing misses with a TTL. Write operations such as create, updateOne, updateMany, deleteOne, deleteMany, and upsert invalidate the affected collection's cached entries after the database write succeeds. It plugs into Payload through the standard plugin interface and replaces payload.db with a decorated adapter during config.onInit. You supply a Redis connection either as a URL string or as an existing ioredis client instance, and the plugin verifies connectivity with a ping before installing the wrapper. Caching is opt-in per collection or global. Each target accepts a TTL (default 300 seconds), a skip flag, and a custom key. A per-request override is available through req.context.cache, so individual calls can bypass the cache, shorten the TTL, or supply a fixed key. Default cache keys are built from slug, operation, locale, and where clauses and hashed with MD5, but you can replace the generator entirely. Invalidation uses Redis pattern matching via redis.keys(), which the README itself flags as a concern for large keyspaces in production. Cache failures are swallowed silently so a Redis outage never breaks a database query. The plugin extends Payload's RequestContext type and works with the MongoDB, Postgres, and SQLite adapters bundled in the dev setup.
Package info
- Package name
payloadcms-redis-plugin- Latest version
0.2.17- Unpacked size
- 88 kB
- License
- MIT
- Weekly downloads
- 80
- Last publish
- Oct 31, 2025
More from ianyimi
View profileSimilar plugins
More in CacheMedia Preview
Preview images, videos, audio, and documents directly in the Payload CMS admin panel.
BlurHash
Generates BlurHash placeholders for images in Payload CMS collections.
Blurhash
Automatically encodes images in Blurhash format for Payload CMS.
ImageKit
Sync images to ImageKit storage directly from Payload CMS.
Media Gallery
Replaces the Payload media collection list view with justified, masonry, and grid layouts plus a lightbox.
Video streaming
Enables video uploads and streaming directly within Payload CMS.