Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httputil: add serve methods for caching #93

Merged
merged 1 commit into from
Oct 28, 2022
Merged

Conversation

calebdoxsey
Copy link
Contributor

@calebdoxsey calebdoxsey commented Oct 28, 2022

Summary

Add ServeXXX methods to httputil to implement caching via the ServeContent function in the http package. This supports ETags computed by taking the fnv hash of a slice of bytes.

This does mean we will buffer all results in memory, but it can save dumping the whole response by returning a 304 when nothing changes.

Related issues

Fixes #92

Checklist

  • reference any related issues
  • updated unit tests
  • add appropriate tag (improvement / bug / etc)
  • ready for review

@calebdoxsey calebdoxsey requested a review from a team as a code owner October 28, 2022 19:18
@calebdoxsey calebdoxsey added the enhancement New feature or request label Oct 28, 2022
@calebdoxsey calebdoxsey merged commit 51ce3fd into main Oct 28, 2022
@calebdoxsey calebdoxsey deleted the cdoxsey/http-caching branch October 28, 2022 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ip2location: add http caching
2 participants