From 5123ffb5014de4e2634bb713f897fc682bd94f2c Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Mon, 13 Apr 2020 06:50:56 +1200 Subject: [PATCH] Add implementation notes for response caching. --- ISSUES/cache-responses.md | 19 +++++++++++++++++++ ISSUES/cache-responses.md~ | 0 2 files changed, 19 insertions(+) delete mode 100644 ISSUES/cache-responses.md~ diff --git a/ISSUES/cache-responses.md b/ISSUES/cache-responses.md index aa5155f..4033371 100644 --- a/ISSUES/cache-responses.md +++ b/ISSUES/cache-responses.md @@ -3,3 +3,22 @@ HTTP responses should be cached locally according to their cache-control headers Especially once Rhapsode starts supporting hyperlinks. This could be developed as an independant project and integrated in! + +## Caching headers +* `CacheControl`, legacy `Pragma: no-cache` +* `Expires`, may also be set via `CacheControl` or `Last-Modified` +* `Etag` - echo back in `If-None-Match` +* `Last-Modified` - echo back in `If-Modified-Since` +* `Vary` - indicates which headers to compare for equality before using a cache. + +Use cached data for 304 responses. + +## Implementation +I'd store an index file, with cached bodies stored seperately. + +There'd be four parts to implementing the cache: +1. Annotating the request. +2. Loading cached data for 304 responses. +3. Storing cache responses. + +GNOME's implementation: https://github.com/GNOME/libsoup/blob/mainline/libsoup/soup-cache.c diff --git a/ISSUES/cache-responses.md~ b/ISSUES/cache-responses.md~ deleted file mode 100644 index e69de29..0000000 -- 2.30.2