From 76a917f11fa91404979f2385d4dd54b8ebd9e7db Mon Sep 17 00:00:00 2001 From: Laurent Savaete Date: Sat, 13 Mar 2021 23:49:29 +0000 Subject: [PATCH] Add example in docs about using redis as backend --- docs/examples.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/examples.md b/docs/examples.md index a72c297..ea052b7 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -55,3 +55,13 @@ You can always switch this during the lifetime of the limiter: ```python limiter.enabled = False ``` + +## Use redis as backend for the limiter + +```python +limiter = Limiter(key_func=get_remote_address, storage_uri="redis://:/n") +``` + +where the /n in the redis url is the database number. To use the default one, just drop the /n from the url. + +There are more examples in the [limits docs](https://limits.readthedocs.io/en/stable/storage.html) which is the library slowapi uses to manage storage.