From a40c54e9e740b75513466e457db4687a23ad3c72 Mon Sep 17 00:00:00 2001 From: Jimmy <19169592+jimtheyounger@users.noreply.github.com> Date: Wed, 29 Sep 2021 16:22:04 +0200 Subject: [PATCH] Update README & add usage --- README.md | 11 +++++++++-- fastapi_cache/backends/dynamodb.py | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 121b939..06dfd11 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ ## Introduction -`fastapi-cache` is a tool to cache fastapi response and function result, with backends support `redis` and `memcache`. +`fastapi-cache` is a tool to cache fastapi response and function result, with backends support `redis`, `memcache`, and `dynamodb`. ## Features -- Support `redis` and `memcache` and `in-memory` backends. +- Support `redis`, `memcache`, `dynamodb`, and `in-memory` backends. - Easily integration with `fastapi`. - Support http cache like `ETag` and `Cache-Control`. @@ -20,6 +20,7 @@ - `asyncio` environment. - `redis` if use `RedisBackend`. - `memcache` if use `MemcacheBackend`. +- `aiobotocore` if use `DynamoBackend`. ## Install @@ -39,6 +40,12 @@ or > pip install "fastapi-cache2[memcache]" ``` +or + +```shell +> pip install "fastapi-cache2[dynamodb]" +``` + ## Usage ### Quick Start diff --git a/fastapi_cache/backends/dynamodb.py b/fastapi_cache/backends/dynamodb.py index 7e0111a..dbdcea6 100644 --- a/fastapi_cache/backends/dynamodb.py +++ b/fastapi_cache/backends/dynamodb.py @@ -17,6 +17,11 @@ class DynamoBackend(Backend): As with all AWS clients, credentials will be taken from the environment. Check the AWS SDK for more information. + + Usage: + >> dynamodb = DynamoBackend(table_name="your-cache", region="eu-west-1") + >> await dynamodb.init() + >> FastAPICache.init(dynamodb) """ def __init__(self, table_name, region=None):