a-luna / fastapi-redis-cache

A simple and robust caching solution for FastAPI that interprets request header values and creates proper response header values (powered by Redis)
MIT License
152 stars 24 forks source link

Add functionality for specifying a web cache expiration #60

Open c-lewis opened 3 years ago

c-lewis commented 3 years ago

It should be possible to use the cache-control header's no-cache directive to force web caches to revalidate cached results before providing them. Unfortunately, some proxy caches do not appear to respect no-cache, and will continue to provide results from cache until they have expired.

This commit allows the Redis and web cache expirations to be set independently, so that items can be cached to Redis with long expirations, but provided to the web with shorter expirations, forcing web caches to revalidate.

ionutbaltariu commented 2 years ago

This looks really nice. It is just sad that this project has been discontinued.