A caching library for FastAPI
Project description
FastAPI-Cacher
FastAPI-Cacher is a caching library inspired by Flask-Caching, designed specifically for FastAPI. It provides an easy-to-use decorator-based approach for adding caching to your FastAPI endpoints, making it simple and intuitive.
Features
- Simple decorator-based caching similar to Flask-Caching.
- Support for various caching backends (Redis, Memcached, etc.).
- Easy integration with FastAPI applications.
Installation
To install FastAPI-Cacher, use pip:
pip install fastapi-cacher
Quick Start
Here's an example of how to use FastAPI-Cacher to cache an endpoint:
from fastapi import FastAPI
from fastapi_cacher import FastAPICache, Cache
app = FastAPI()
cache = Cache(app)
@app.get('/')
@cache.cached(timeout=50)
async def index():
return {'message': 'Hello, world!'}
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
Contributing
We welcome contributions! Please check the issues on GitHub and feel free to submit pull requests.
License
This project is licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastapi-cacher-0.1.0.tar.gz
(12.0 kB
view hashes)
Built Distribution
Close
Hashes for fastapi_cacher-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31f7bc05c487cdd86183e6f4bdc72538f5d596d518a49eb8c0737322bc0a3c4e |
|
MD5 | 83f24d7688cd19b539b8b8786516b33e |
|
BLAKE2b-256 | e55c1370932d6d742195840fd676e7369a1bb9357e2f02f6597a7af5689566bd |