|
1 | | -# Welcome to MkDocs |
| 1 | +# FastAPI-Redis-Cache-Reborn |
2 | 2 |
|
3 | | -For full documentation visit [mkdocs.org](https://www.mkdocs.org). |
| 3 | +## Introduction |
4 | 4 |
|
5 | | -## Commands |
| 5 | +A simple and robust caching solution for FastAPI that interprets request header |
| 6 | +values and creates proper response header values (powered by Redis) |
6 | 7 |
|
7 | | -* `mkdocs new [dir-name]` - Create a new project. |
8 | | -* `mkdocs serve` - Start the live-reloading docs server. |
9 | | -* `mkdocs build` - Build the documentation site. |
10 | | -* `mkdocs -h` - Print help message and exit. |
| 8 | +This project is a continuation of |
| 9 | +[fastapi-redis-cache](https://github.com/a-luna/fastapi-redis-cache){:target="_blank"} |
| 10 | +which seems to no longer be maintained and had fallen behind in both Redis and |
| 11 | +FastAPI versions. I decided to split this as a separate repository rather than a |
| 12 | +fork, since the original project has had no activity for a over three years. |
11 | 13 |
|
12 | | -## Project layout |
| 14 | +Right now the code is basically the same as the original project, but I have |
| 15 | +updated the Package management system to use Poetry, the dependencies and the |
| 16 | +CI/CD pipeline, and added type-hinting. I've also merged some open PRs from the |
| 17 | +original project that fixed some issues. |
13 | 18 |
|
14 | | - mkdocs.yml # The configuration file. |
15 | | - docs/ |
16 | | - index.md # The documentation homepage. |
17 | | - ... # Other markdown pages, images and other files. |
| 19 | +See the TODO File file for a list of things I plan to do in the near future. |
| 20 | + |
| 21 | +The package still has the same interface and classes as the original. You will |
| 22 | +still import the package as `fastapi_redis_cache` in your code, the name has only |
| 23 | +changed on PyPI to avoid conflicts with the original package. This is to make it |
| 24 | +transparent to migrate to this version. |
| 25 | + |
| 26 | +!!! warning "Important" |
| 27 | + It is important to make sure that the old package is uninstalled before |
| 28 | + installing this one. The package name has changed, but the module name is |
| 29 | + still `fastapi_redis_cache`. **The best way is to remove your old virtual |
| 30 | + environment and run `poetry install` or `pip install` again**. |
| 31 | + |
| 32 | +## Features |
| 33 | + |
| 34 | +- Cache response data for async and non-async path operation functions. |
| 35 | +- Lifetime of cached data is configured separately for each API endpoint. |
| 36 | +- Requests with `Cache-Control` header containing `no-cache` or `no-store` are |
| 37 | + handled correctly (all caching behavior is disabled). |
| 38 | +- Requests with `If-None-Match` header will receive a response with status `304 NOT |
| 39 | + MODIFIED` if ETag for requested resource matches header value. |
0 commit comments