Commit Graph
23 Commits
Author SHA1 Message Date
Karl Seguin 3213342055 http: improve caching
1 - Centralized cache-awareness into Cache and pulled header details out of
    SqliteCache and HttpClient

2 - Added support for expires header

3 - Support caching more status types (but not all, since HttpClient would need
    to be aware of what caching a 3xx/206 means)

4 - Revalidate cares about  "not specified" vs "no-store" vs "stale"
    (e.g. expires=0 means "stale", not fallthrough the last-modified logic)
2026-09-21 11:38:34 +08:00
Karl Seguin 2e6999f20b chore: make declarations private if they don't need to be public
This change is 99%  s/pub//   + a handful of dead code removal.
2026-09-10 14:42:09 +08:00
Karl Seguin a5e27869d3 chore: remove unused imports 2026-09-05 17:51:47 +08:00
Karl Seguin a3034105aa chore: Move cache maintenance to startup and browser.deinit
--http-cache-entry-limit is currently implemented as a hard-limit via a check
on every put. For a large --http-cache-entry-limit, this can result in a non-
trivial delay on every http get.

This commit calls cache.maintenance() on Browser.deinit and on startup.
maintenance:
1 - purges stale entries
2 - enforces the limit

With concurrent requests, the number of entries can easily exceed the limit by
hundreds of entries (but this is temporary).
2026-08-14 15:55:37 +08:00
Muki Kiboigo 32364a26da use proper default on http_cache_entry_limit option 2026-08-07 08:01:55 -07:00
Muki Kiboigo f80aa2882c use a better query for evictOverflow 2026-08-07 08:01:54 -07:00
Muki Kiboigo 4f5bcec9a6 add max entry limiting to SqliteCache 2026-08-06 13:29:22 -07:00
Muki Kiboigo bf35489192 add content_type column in Cache 2026-08-03 18:26:58 -07:00
Muki Kiboigo ea0a45c713 add format for SqliteCachePath 2026-08-03 18:26:58 -07:00
Muki Kiboigo 0b74224b15 use CachePutRequest for puts instead of CacheMetadata 2026-08-03 18:26:57 -07:00
Muki Kiboigo 65448bbde6 clear old non-Vary headers on renew 2026-08-03 18:26:13 -07:00
Muki Kiboigo 6c56144ef9 rework get to be strictly deferred 2026-08-03 18:26:12 -07:00
Muki Kiboigo d16408d2d8 add transaction begin types 2026-08-03 18:17:44 -07:00
Muki Kiboigo a03471a1ce add test for no validators behavior 2026-08-03 18:17:44 -07:00
Muki Kiboigo 8dc2488835 always defer conn.rollback after tx begin 2026-08-03 18:17:44 -07:00
Muki Kiboigo 65593179ea early exit on SqliteCache.get on expired without validators 2026-08-03 18:17:44 -07:00
Muki Kiboigo 3bfec6d7ff skip body dupe on expired without validators on Cache.get 2026-08-03 18:17:43 -07:00
Muki Kiboigo 04e93cd592 check vary before we dupe in SqliteCache.get 2026-08-03 18:17:43 -07:00
Muki Kiboigo a96543052c manually delete and reinsert 2026-08-03 18:17:43 -07:00
Muki Kiboigo 671b110aa2 loadBody can return null 2026-08-03 18:17:43 -07:00
Muki Kiboigo 4d59b61a33 remove primary key on url name 2026-08-03 18:17:43 -07:00
Muki Kiboigo 047280e0d6 use strict tables 2026-08-03 18:17:43 -07:00
Muki Kiboigo 0f2957cda2 add SqliteCache as default local impl 2026-08-03 18:17:40 -07:00