Maven Virtual Registry: Cache logic
🔭 Issues plan
- Maven Virtual Registry: Database models (#467972 - closed).
- Maven Virtual Registry: Permissions policy (#467977 - closed).
- Maven Virtual Registry: Registry models API (#467979 - closed).
- Maven Virtual Registry: Maven API endpoint (#467982 - closed).
-
Maven Virtual Registry: Cache logic (#467983 - closed).
👈 You're here. - Maven Registry: Cached responses destruction (#468113 - closed).
- Improve workhorse dependencyproxy logic (#461561 - closed).
- Maven Virtual Registry: Documentation (#468115 - closed).
- Maven Virtual Registry: Performance review (#468116 - closed).
- Maven Virtual Registry: feature flag cleanup (#468117).
🗒 Description
Cold cache or when the related cached response doesn't exist:
- Use workhorse
senddependencylogic to return and upload the response from upstream.- At this time, record the
ETagsent by upstream. - Set the
upstream_etag_checked_atto now. - Set the
downloaded_atto now. - Set the
download_countto1.
- At this time, record the
Warm cache or when the related cached response exist:
- Check if now is within [upstream_etag_checked_at, upstream_etag_checked_at + cache_validity_period_hours].
- If that's the case, use workhorse
sendurlto send the cached_response.- Set the
downloaded_atto now. - Set the
download_countto+1.
- Set the
- If that's not the case, ping the related upstream to get the
ETagheader (HEADrequest).- If the
ETagis the same, use workhorsesendurlto send the cached_response.- Set the
upstream_etag_checked_atto now. - Set the
downloaded_atto now. - Set the
download_countto+1.
- Set the
- If the
ETagis not the same (stale cached response), destroy the cached_response and use workhorsesenddependencylogic to return and upload the response from upstream.- At this time, record the
ETagsent by upstream. - Set the
upstream_etag_checked_atto now. - Set the
downloaded_atto now. - Set the
download_counttodownload_countof the destroyed cached_response +1. (thedownload_countcarries over the cached response destruction.)
- At this time, record the
- If the
- Special case:
ETagheader is missing from upstream. Execute the "ETag is not the same" branch.
- If that's the case, use workhorse
Edited by David Fernandez