HTTP client with cache?


Is there a caching HTTP client for Rust?

I’ve rolled out my own naive if !cached_result.exists() {request.get()}, but it should do expiry, revalidation, etc.


I guess I’ll have to write one. Let me know if you want to help :slight_smile:


I mean I guess at least servo has one? :stuck_out_tongue:


It depends, most often you probably don’t want the entire response cached, but only what you used it for. Also what you want to do when the response code is not 200 is not evident. For a create I just published I also use a cache, which is filled by a http request. but in this case I want to cache the Schema I get from the response, not the response itself.


My plan is to port to Rust


I’ve written static_http_cache, but it’s only really useful for static content. That is, it validates with the ETag header and If-Modified-Since, but it doesn’t do anything with timed expiry or the more sophisticated cache-control headers.