enso icon indicating copy to clipboard operation
enso copied to clipboard

HTTP response caching, with TTL and LRU logic

Open GregoryTravis opened this issue 1 year ago • 1 comments

This implements

  • A response cache for HTTP.{fetch,request} and Data.{read,fetch} and other methods that use those. (Data.download is not cached.)
  • Per-file request limit
  • Total cache size limit
  • TTL logic, based on HTTP response headers if available
  • LRU logic for removing old entries to make room

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • [x] The documentation has been updated, if necessary.
  • [x] Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • [x] All code follows the Scala, Java, TypeScript, and Rust style guides. In case you are using a language not listed above, follow the Rust style guide.
  • [x] Unit tests have been written where possible.
  • [x] If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries, or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

GregoryTravis avatar Oct 16 '24 17:10 GregoryTravis

Comments resolved except for nio change.

GregoryTravis avatar Oct 17 '24 20:10 GregoryTravis

@radeusgd I implemented your excellent suggestion, including the metadata handling. I also separated it into EnsoHTTPResponseCache (which handles headers, TTL calculation, etc) from LRUCache (which handles caching, downloading, expiry, etc), as per @jdunkerley's suggestion.

GregoryTravis avatar Oct 22 '24 18:10 GregoryTravis