long2ice/fastapi-cache

clearing cache not having effect as max-age directive is making browser not connectin to the server to check the if cache is valid

IOR88 opened this issue · 0 comments

I think the end part of the code is making the browser to not refresh the cache, I saw discussions about it in the forum but not sure how we could change it, as I think this logic maybe different on per view basis ? I have one api for which I need to clear cache when other apis are triggered to refresh information, in that case I cannot pass max-age, I should pass no-cache, as other way browser is not verifying if cache is valid.

            # response.headers["Cache-Control"] = f"max-age={expire}"
            etag = f"W/{hash(encoded_ret)}"
            response.headers["ETag"] = etag
            return ret