Closed man90es closed 9 months ago
@octoman90 do you think it is worth adding Cache-Control
header as well?
@victorspringer are you going to do a review/merge this? or do you have plans to add cache-related response headers?
@davitovmasyan, this functionality can totally be achieved by setting a combination of Cache-Control
and Age
headers: this approach would even offer some additional features that Expires
header doesn't have. But I don't really need them in my project, so I went for the simplest solution.
I hope this PR gets merged one day, along with the other one I made. Until then, I'm using my own fork in said project by having
replace github.com/victorspringer/http-cache => github.com/octoman90/http-cache v0.0.0-20220627112407-5a1d73af7fc5
in go.mod
good idea
LGTM. Sorry for the inactivity guys, I'm merging this PR. @man90es thanks for the contribution!
This pull request adds an option to automatically add an Expires header to all responses. This will let the client (e.g. frontend) to know the exact time when the server cache will expire and utilise disk cache to reduce the number of requests. The option is off by default so it should be completely backward compatible with previous library versions.