Cache-Control header management for FastAPI
Provide middleware to control Cache-Control header.
This package is not registered in PyPI. Wheel is stored in GitHub Releases.
from fastapi import FastAPI
from fastapi_simple_cachecontrol.types import CacheControl
from fastapi_simple_cachecontrol.middleware import CacheControlMiddleware
app = FastAPI()
app.add_middleware(CacheControlMiddleware, cache_control=CacheControl("public"))
- You can select only one of cacheability directives.
- Supporting
public
,private
,no-cache
andno-store
- Supporting
- Expires directives are used as value if only used
public
orprivate
.