The Strapi REST Cache Plugin is a community-maintained solution for accelerating HTTP requests within Strapi applications by implementing a caching layer. It utilizes a provider-based architecture, allowing developers to choose from various storage backends like in-memory, Redis, or file system for caching responses. The plugin supports configurable caching strategies and features automatic invalidation of cached data when related content types are updated, mitigating issues with stale data. While the provided metadata indicates version 4.2.9, the latest significant release is v5.0.0, which introduced breaking changes for Strapi v5 compatibility. The project maintains an active development cadence, with frequent updates addressing bugs and adding features, aiming to improve Strapi API performance. It differentiates itself by its flexible provider system and automatic cache invalidation tied to Strapi content updates.
npm install strapi-plugin-rest-cacheVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to enable the `rest-cache` plugin in a Strapi v4/v5 application using an in-memory provider and configure basic caching for specific content types in `config/plugins.js`.
Update your `package.json` to use the new scoped package names (`@strapi-community/plugin-rest-cache`, `@strapi-community/provider-rest-cache-*`) and reinstall dependencies. Adjust any internal references in configuration files.
If you were using the Couchbase Provider, you must migrate to an alternative provider such as Redis or implement a custom provider. There is no direct replacement within the plugin for Couchbase.
Exercise caution, thoroughly test in development environments, and monitor the official GitHub repository for updates and breaking changes. Consider this for any version based on README warnings.
Ensure your Strapi project is on version 4 or higher. For Strapi v3, use `strapi-middleware-cache` instead.
Ensure you are using the correct package name `@strapi-community/plugin-rest-cache` in your `package.json` and in your Strapi plugin configuration file (e.g., `config/plugins.js`).
Review your `config/plugins.js` file for the `rest-cache` entry. Ensure that `enabled: true` is set and that the `config` object correctly defines a `provider` and `strategy` with valid options, including `name` for the provider.
Verify that the `contentTypes` array in your plugin configuration's `strategy` includes the exact API ID of the content types you expect to be purged. E.g., `['api::article.article']`.