From b35bd9a11139dca9ff6b85190f44d93785deecc3 Mon Sep 17 00:00:00 2001 From: Cristian Etchebarne Date: Tue, 22 Apr 2025 09:42:48 -0300 Subject: [PATCH] chore: Update docs to reflect Cluster usage --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 837f75d..af155b3 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,19 @@ const client = new Redis({ host: 'localhost', port: 6379 }) fastify.register(require('@fastify/redis'), { client }) ``` +You can also supply a *Redis Cluster* instance to the client: + +```js +'use strict' + +const fastify = require('fastify')() +const Redis = require('ioredis') + +const client = new Redis.Cluster([{ host: 'localhost', port: 6379 }]); + +fastify.register(require('@fastify/redis'), { client }) +``` + Note: by default, *@fastify/redis* will **not** automatically close the client connection when the Fastify server shuts down.