fastapi-cache
fastapi-cache copied to clipboard
No option to customise Cache-Control response header
I would like to set Cache-Control: no-cache to be returned for resources that should be revalidated with the server before every use (in addition to other parameters I set such as expiry.
However, the code currently does not allow any customisation and only sets max-age.
Note L201 in fastapi_cache>decorator.py:
if response:
response.headers.update(
{
"Cache-Control": f"max-age={expire}",
"ETag": f"W/{hash(to_cache)}",
cache_status_header: "MISS",
}
)
"Cache-Control": f"max-age={expire}",
This prevents me from using the library in production environments as it can generate really state content... If I submit a PR to allow customising this, will it kindly be reviewed and merged promptly considering the outstanding PR count?
Thank you! EE