mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-25 04:57:54 +00:00
Update README & add usage
This commit is contained in:
11
README.md
11
README.md
@@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
## Introduction
|
## 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
|
## Features
|
||||||
|
|
||||||
- Support `redis` and `memcache` and `in-memory` backends.
|
- Support `redis`, `memcache`, `dynamodb`, and `in-memory` backends.
|
||||||
- Easily integration with `fastapi`.
|
- Easily integration with `fastapi`.
|
||||||
- Support http cache like `ETag` and `Cache-Control`.
|
- Support http cache like `ETag` and `Cache-Control`.
|
||||||
|
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
- `asyncio` environment.
|
- `asyncio` environment.
|
||||||
- `redis` if use `RedisBackend`.
|
- `redis` if use `RedisBackend`.
|
||||||
- `memcache` if use `MemcacheBackend`.
|
- `memcache` if use `MemcacheBackend`.
|
||||||
|
- `aiobotocore` if use `DynamoBackend`.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
@@ -39,6 +40,12 @@ or
|
|||||||
> pip install "fastapi-cache2[memcache]"
|
> pip install "fastapi-cache2[memcache]"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```shell
|
||||||
|
> pip install "fastapi-cache2[dynamodb]"
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Quick Start
|
### Quick Start
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ class DynamoBackend(Backend):
|
|||||||
|
|
||||||
As with all AWS clients, credentials will be taken from the environment. Check the AWS SDK
|
As with all AWS clients, credentials will be taken from the environment. Check the AWS SDK
|
||||||
for more information.
|
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):
|
def __init__(self, table_name, region=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user