Adds a Redis cache layer to Payload API endpoints. Cache entries are keyed by the user's collection and the original URL. It is registered in the Payload config as a plugin and initialised with a Redis connection in the server file. It requires a Redis instance and the redis package, and targets Payload 1.x.
Redis cache plugin for Payload CMS
Installation
npm i @aengz/payload-redis-cache64
Stars
13
Forks
4
Open Issues
2 years ago
Last Updated
280
Weekly Downloads
v1.1.1
npm Version
41.3 KB
Unpacked Size
0
Dependencies
64+3 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 64 |
| Dec 4, 2026 | 64 |
| Dec 3, 2026 | 64 |
| Dec 2, 2026 | 64 |
| Dec 1, 2026 | 64 |
| Nov 30, 2026 | 64 |
| Nov 29, 2026 | 64 |
| Nov 28, 2026 | 64 |
| Nov 27, 2026 | 64 |
| Nov 26, 2026 | 64 |
| Nov 25, 2026 | 64 |
| Nov 24, 2026 | 64 |
| Nov 23, 2026 | 64 |
| Nov 22, 2026 | 64 |
| Nov 21, 2026 | 64 |
| Nov 20, 2026 | 64 |
| Nov 19, 2026 | 64 |
| Nov 18, 2026 | 64 |
| Nov 17, 2026 | 64 |
| Nov 16, 2026 | 64 |
| Nov 15, 2026 | 64 |
| Nov 14, 2026 | 64 |
| Nov 13, 2026 | 64 |
| Nov 12, 2026 | 64 |
| Nov 11, 2026 | 64 |
| Nov 10, 2026 | 64 |
| Nov 9, 2026 | 64 |
| Nov 8, 2026 | 64 |
| Nov 7, 2026 | 64 |
| Nov 6, 2026 | 64 |
| Nov 5, 2026 | 64 |
| Nov 4, 2026 | 64 |
| Nov 3, 2026 | 64 |
| Nov 2, 2026 | 64 |
| Nov 1, 2026 | 64 |
| Oct 31, 2026 | 64 |
| Oct 30, 2026 | 64 |
| Oct 29, 2026 | 64 |
| Oct 28, 2026 | 64 |
| Oct 27, 2026 | 64 |
| Oct 26, 2026 | 64 |
| Oct 25, 2026 | 64 |
| Oct 24, 2026 | 64 |
| Oct 23, 2026 | 64 |
| Oct 22, 2026 | 64 |
| Oct 21, 2026 | 64 |
| Oct 20, 2026 | 64 |
| Oct 19, 2026 | 64 |
| Oct 18, 2026 | 64 |
| Oct 17, 2026 | 64 |
| Oct 16, 2026 | 64 |
| Oct 15, 2026 | 64 |
| Oct 14, 2026 | 64 |
| Oct 13, 2026 | 64 |
| Oct 12, 2026 | 64 |
| Oct 11, 2026 | 63 |
| Oct 10, 2026 | 63 |
| Oct 9, 2026 | 63 |
| Oct 8, 2026 | 63 |
| Oct 7, 2026 | 63 |
| Oct 6, 2026 | 63 |
| Oct 5, 2026 | 63 |
| Oct 4, 2026 | 63 |
| Oct 3, 2026 | 63 |
| Oct 2, 2026 | 63 |
| Oct 1, 2026 | 63 |
| Sep 30, 2026 | 63 |
| Sep 29, 2026 | 63 |
| Sep 28, 2026 | 63 |
| Sep 27, 2026 | 63 |
| Sep 26, 2026 | 63 |
| Sep 25, 2026 | 63 |
| Sep 24, 2026 | 63 |
| Sep 23, 2026 | 63 |
| Sep 22, 2026 | 63 |
| Sep 21, 2026 | 63 |
| Sep 20, 2026 | 63 |
| Sep 19, 2026 | 63 |
| Sep 18, 2026 | 63 |
| Sep 17, 2026 | 63 |
| Sep 16, 2026 | 63 |
| Sep 15, 2026 | 62 |
| Sep 14, 2026 | 62 |
| Sep 13, 2026 | 62 |
| Sep 12, 2026 | 62 |
| Sep 11, 2026 | 62 |
| Sep 10, 2026 | 62 |
| Sep 9, 2026 | 61 |
| Sep 8, 2026 | 61 |
| Sep 7, 2026 | 61 |
| Sep 6, 2026 | 61 |
260+193 since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 260 |
| Dec 4, 2026 | 183 |
| Dec 3, 2026 | 156 |
| Dec 2, 2026 | 140 |
| Dec 1, 2026 | 114 |
| Nov 30, 2026 | 124 |
| Nov 29, 2026 | 86 |
| Nov 28, 2026 | 90 |
| Nov 27, 2026 | 101 |
| Nov 26, 2026 | 89 |
| Nov 25, 2026 | 109 |
| Nov 24, 2026 | 104 |
| Nov 23, 2026 | 94 |
| Nov 22, 2026 | 72 |
| Nov 21, 2026 | 75 |
| Nov 20, 2026 | 66 |
| Nov 19, 2026 | 75 |
| Nov 18, 2026 | 127 |
| Nov 17, 2026 | 120 |
| Nov 16, 2026 | 121 |
| Nov 15, 2026 | 119 |
| Nov 14, 2026 | 117 |
| Nov 13, 2026 | 122 |
| Nov 12, 2026 | 113 |
| Nov 11, 2026 | 55 |
| Nov 10, 2026 | 88 |
| Nov 9, 2026 | 88 |
| Nov 8, 2026 | 83 |
| Nov 7, 2026 | 82 |
| Nov 6, 2026 | 84 |
| Nov 5, 2026 | 101 |
| Nov 4, 2026 | 106 |
| Nov 3, 2026 | 75 |
| Nov 2, 2026 | 74 |
| Nov 1, 2026 | 74 |
| Oct 31, 2026 | 76 |
| Oct 30, 2026 | 71 |
| Oct 29, 2026 | 49 |
| Oct 28, 2026 | 26 |
| Oct 27, 2026 | 34 |
| Oct 26, 2026 | 54 |
| Oct 25, 2026 | 54 |
| Oct 24, 2026 | 52 |
| Oct 23, 2026 | 43 |
| Oct 22, 2026 | 57 |
| Oct 21, 2026 | 115 |
| Oct 20, 2026 | 106 |
| Oct 19, 2026 | 84 |
| Oct 18, 2026 | 85 |
| Oct 17, 2026 | 81 |
| Oct 16, 2026 | 92 |
| Oct 15, 2026 | 90 |
| Oct 14, 2026 | 72 |
| Oct 13, 2026 | 75 |
| Oct 12, 2026 | 77 |
| Oct 11, 2026 | 77 |
| Oct 10, 2026 | 78 |
| Oct 9, 2026 | 78 |
| Oct 8, 2026 | 80 |
| Oct 7, 2026 | 43 |
| Oct 6, 2026 | 39 |
| Oct 5, 2026 | 39 |
| Oct 4, 2026 | 41 |
| Oct 3, 2026 | 44 |
| Oct 2, 2026 | 42 |
| Oct 1, 2026 | 34 |
| Sep 30, 2026 | 82 |
| Sep 29, 2026 | 82 |
| Sep 28, 2026 | 80 |
| Sep 27, 2026 | 84 |
| Sep 26, 2026 | 116 |
| Sep 25, 2026 | 151 |
| Sep 24, 2026 | 150 |
| Sep 23, 2026 | 105 |
| Sep 22, 2026 | 114 |
| Sep 21, 2026 | 146 |
| Sep 20, 2026 | 145 |
| Sep 19, 2026 | 109 |
| Sep 18, 2026 | 87 |
| Sep 17, 2026 | 88 |
| Sep 16, 2026 | 91 |
| Sep 15, 2026 | 82 |
| Sep 14, 2026 | 52 |
| Sep 13, 2026 | 78 |
| Sep 12, 2026 | 84 |
| Sep 11, 2026 | 73 |
| Sep 10, 2026 | 92 |
| Sep 9, 2026 | 90 |
| Sep 8, 2026 | 99 |
| Sep 7, 2026 | 97 |
| Sep 6, 2026 | 67 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/579188648-root)<a href="https://payloaddirectory.dev/plugins/579188648-root"><img src="https://payloaddirectory.dev/badge/579188648-root.svg" alt="Payload Directory"></a>README
This plugin for Payload CMS adds a cache layer to API endpoints. The cache is based on the combination of the user's collection and the original URL.
1.0.19 or higher is requiredTo install the plugin, run one of the following commands:
yarn add @aengz/payload-redis-cache
or
npm install @aengz/payload-redis-cache
You also need to install the redis package if it is not already installed:
yarn add redis
or
npm install redis
To use the plugin, add it to the Payload config as follows:
import { buildConfig } from 'payload/config';
import { cachePlugin } from '@aengz/payload-redis-cache'
const config = buildConfig({
// your config here
plugins: [
cachePlugin({
excludedCollections: ['users'],
// excludedGlobals: ['myglobal']
})
]
})
Add the initializer function in server.ts
import { cachePlugin } from '@aengz/payload-redis-cache'
...
initRedis({
redisUrl: process.env.REDIS_URI
})
| Option | Type | Description |
|---|---|---|
redisUrl * | string | Redis instance's url. |
redisNamespace | string | Choose the prefix to use for cache redis keys. Defaults to payload. |
redisIndexesName | string | Choose the index key for cache redis indexes. Defaults to payload-cache-index. |
excludedCollections | string[] | An array of collection names to be excluded. |
excludedGlobals | string[] | An array of globals names to be excluded. |
includedPaths | string[] | An array of custom routes to be included. |
A * denotes that the property is required.
This package provides utility functions for managing the cache. Here's an example of how to use the invalidateCache function:
import { invalidateCache } from '@aengz/payload-redis-cache'
...
invalidateCache()
There is a development environment in the /dev directory of the repository. To use it, create a new .env file in the /dev directory using the example .env.example file as a reference:
cd dev
cp .env.example .env
Before using the plugin in the development environment, the package needs to be built. To build the library, run one of the following commands:
Build the lib using:
yarn dev:build
or
npm run dev:build
To run the development environment, use the following command:
yarn dev
or
npm run dev
To run the test suite, use one of the following commands:
yarn test
or
npm run test
Topics
payload revalidate
Field-driven Next.js cache revalidation for Payload with id-keyed cached finders and a dependency map
59240/wk18v3
cached local api
Cache Payload Local API operations with Next.js unstable_cache and automatic tag-based revalidation
48112/wk335v3
payloadcms redis cache
Redis client helper for caching Payload collection data in Next.js apps
3813/wk2v?
payload dependency graph
Tracks dependencies between collections and globals so you know which content depends on which
032/wk14v2
payload upstash
Upstash Redis key-value adapter for Payload's built-in KV store
82333/wk7v3 v4
payload kv
Store counters, feeds and expiring data in Redis or KV stores while querying them as normal Payload fields
771.4k/wk0v3 v4