Skip to content

strapi-community/plugin-redis

Repository files navigation

Strapi Redis Plugin

Redis Connector Package for use in other plugins and packages.

Strapi Discord NPM Version Monthly download on NPM

Table of Contents

🚦 Current Status

This package is currently maintained and should be considered Stable/GA in terms of state. I/We are currently accepting contributions and/or dedicated contributors to help develop and maintain this package.

For more information on contributing please see the contrib message below.

🛑 Foreword

This package's lead maintainer is an employee of Strapi however this package is not officially maintained by Strapi Solutions SAS nor Strapi, Inc. and is currently maintained in the free time of the lead maintainer.

Warning

Absolutely no part of this code should be considered covered under any agreement you have with Strapi proper including but not limited to any Enterprise and/or Cloud Agreement you have with Strapi.

✨ Features

This plugin utilizes 2 core packages:

  • ioredis - for all connection management to any Redis or Redis-compatible database
  • redlock - for distributed locks related to Strapi's built in cron-tasks system

These are the primary features that are finished or currently being worked on:

  • Updated/New Documentation outside of this README
  • Multiple connections/databases
  • Redlock capabilities with Strapi's built-in cron tasks
  • Admin Panel interface to see all existing connections
  • Admin Panel interface to see the stored key/values within the connections
  • Admin Panel interface to see the current server statistics

🤔 Motivation

The purpose of this package is to have a universal Redis connector for all packages wanting to utilize a Redis database and/or for those wanting to develop custom functions and code within your Strapi project and would prefer a centralized Redis database for various purposes.

A few examples of where Redis could be used within a Strapi application:

  • LRU-based response cache for REST
  • Apollo server GraphQL cache
  • IP Rate-limiting using something like koa2-ratelimit
  • Server-side user session storage
  • So much more

If you are currently using this package in your plugin and would like to be featured, please feel free to submit an issue to have your plugin added to the list below:

Note the following packages used to use this package with Strapi v4 but have since been merged into this package:

🖐 Requirements

Caution

This plugin will not work with Strapi v3 projects as it utilizes APIs that don't exist in the v3!

Supported Strapi Versions:

Strapi Version Plugin Version Supported Tested On
v3.x.x N/A N/A
v4.x.x 1.1.0 Sept 2024
v5.x.x 2.0.0 Sept 2024

⏳ Installation

Warning

For Strapi 4 projects you should use the 1.x.x version of this plugin, for Strapi 5 projects you should use the 2.x.x version of this plugin.

Note

For Strapi 5 the package name has changed from strapi-plugin-redis to @strapi-community/plugin-redis.

Install the plugin in your Strapi project or your Strapi plugin.

Strapi Version Plugin Version Package Manager Command
v4.x.x 1.1.0 Yarn yarn add [email protected]
v5.x.x Latest Yarn yarn add @strapi-community/plugin-redis
v4.x.x 1.1.0 npm npm i [email protected]
v5.x.x Latest npm npm i @strapi-community/plugin-redis

🔧 Configuration

See our Documentation for more information on how to configure and use this plugin.

Contributing

I/We are actively looking for contributors, maintainers, and others to help shape this package. As this plugins sole purpose within the Strapi community is to be used by other developers and plugin maintainers to help ease the connection to Redis databases.

Instead of reinventing the wheel every time you need to connect to Redis, the hope is to centralize the connections in a single plugin that all plugins can piggy back on.

If interested please feel free to open up a GitHub issue/PR or ping DMehaffy on Discord.

Note

This package is maintained collectively by the strapi community organization. While there may be a lead maintainer, they are not the sole maintainer of this code and this code does not belong to the lead maintainer.

License

See the LICENSE file for licensing information.