Installation
Add required dependencies
bashyarn add @strapi-community/plugin-rest-cachebashyarn add \ @strapi-community/plugin-rest-cache \ @strapi-community/plugin-redis \ @strapi-community/provider-rest-cache-redisINFO
This plugin is only compatible with Strapi v5.0.0 and above.
If you are looking for a plugin for Strapi v4.x, please check the legacy documentation.
If you are looking for a plugin for Strapi v3.x, please check the strapi-middleware-cache.Enable the plugin in
./config/plugins.jsjsmodule.exports = { "rest-cache": { config: { provider: { name: "memory", options: { max: 32767, maxAge: 3600, }, }, strategy: { contentTypes: [ // list of Content-Types UID to cache "api::category.category", "api::article.article", "api::global.global", "api::homepage.homepage", ], }, }, }, };jsmodule.exports = { // Step 1: Configure the redis connection // @see https://github.com/strapi-community/plugin-redis redis: { // ... }, // Step 2: Configure the redis cache plugin "rest-cache": { config: { provider: { name: "redis", options: { max: 32767, connection: "default", }, }, strategy: { // if you are using keyPrefix for your Redis, please add <keysPrefix> keysPrefix: "<redis_keyPrefix>", contentTypes: [ // list of Content-Types UID to cache "api::category.category", "api::article.article", "api::global.global", "api::homepage.homepage", ], }, }, }, };