DEV Community

Cover image for Strapi REST Cache Plugin Now Supports Strapi v5
Theodore Kelechukwu Onyejiaku for Strapi

Posted on • Originally published at strapi.io

Strapi REST Cache Plugin Now Supports Strapi v5

The Strapi Rest Cache plugin from the Strapi Community organization has been migrated to Strapi v5! This update has been a long time coming and took the collaboration of multiple people from the community which ultimately led to this new version.

Strapi REST Cache Plugin.png

Introduction

The Strapi REST Cache Plugin is designed to speed up HTTP GET requests in Strapi by caching responses using an LRU (Least Recently Used) strategy.

It supports multiple storage backends (in-memory, Redis, or custom providers), and allows fine-grained control over what to cache via strategies such as content type, routes, query parameters, and headers.

The plugin automatically invalidates (or “busts”) cached entries when the underlying content changes (via POST, PUT, DELETE), ensuring data freshness. It also offers tools like logging, ETag support, and the ability to purge the cache manually via the admin UI. 

Strapi REST cache plugin Architecture.png

Getting Started

To get started with caching your Strapi Rest API you can simply install the plugin by running the following command which will set you up with the default memory provider:

yarn add @strapi-community/plugin-rest-cache
Enter fullscreen mode Exit fullscreen mode

Exhaustive Documentation

If you want to learn more about how this plugin exactly works, or if you wan to try out the Redis provider, you can keep reading on it's dedicated documentation website.

What Changed in v5

Alongside the migration to v5, we've seized the opportunity to make some breaking changes. I'll list them here:

  1. Package names have been changed:
strapi-plugin-rest-cache -> @strapi-community/plugin-rest-cache
strapi-provider-rest-cache-memory -> @strapi-community/provider-rest-cache-memory
strapi-provider-rest-cache-redis -> @strapi-community/provider-rest-cache-redis
Enter fullscreen mode Exit fullscreen mode
  1. Couchbase Provider has been entirely removed as very little people were using it.
  2. Updated cache-manager to version 7.
  3. Inject middlewares instead of using router caching.

Community Feedback

We're eager for you to get started using this plugin! It's taken a lot of work to migrate and we would love to get your feedback on it! So please go ahead and install it and let us know what your think! You can reach out through Github issues, or just shoot a message on Discord!

Strapi Marketplace

Visit the Strapi marketplace to power up your Strapi app with the industry-leading software and easily add custom features using plugins.

Top comments (0)