Skip to content

Cache Revalidation#2570

Merged
krichprollsch merged 20 commits into
mainfrom
cache-revalidation
Jun 18, 2026
Merged

Cache Revalidation#2570
krichprollsch merged 20 commits into
mainfrom
cache-revalidation

Conversation

@mookums

@mookums mookums commented May 28, 2026

Copy link
Copy Markdown
Contributor

This adds Cache Revalidation, properly checking no-cache and stale entries.

@mookums mookums force-pushed the cache-revalidation branch from 3862057 to ab1df20 Compare May 28, 2026 17:47
Comment thread src/network/cache/Cache.zig Outdated
Comment thread src/network/layer/CacheLayer.zig Outdated
@mookums mookums marked this pull request as ready for review June 1, 2026 13:45
@mookums mookums force-pushed the cache-revalidation branch from 0d5fe20 to c45ced3 Compare June 3, 2026 14:11
@mookums mookums mentioned this pull request Jun 3, 2026
@mookums mookums requested a review from karlseguin June 5, 2026 14:27
@karlseguin

Copy link
Copy Markdown
Collaborator

I tested it and it doesn't work. Wrong results + crash.

@mookums mookums force-pushed the cache-revalidation branch 2 times, most recently from 5ab805c to fd8cb46 Compare June 8, 2026 15:01
@mookums mookums force-pushed the cache-revalidation branch from fd8cb46 to 2414a67 Compare June 14, 2026 16:29
@krichprollsch

krichprollsch commented Jun 15, 2026

Copy link
Copy Markdown
Member

@mookums Do you have a corresponding PR on demo to add more tests? found lightpanda-io/demo#185

Comment thread src/network/layer/CacheLayer.zig
Comment thread src/network/layer/CacheLayer.zig
Comment thread src/network/layer/CacheLayer.zig Outdated
Comment thread src/network/cache/Cache.zig
@krichprollsch

krichprollsch commented Jun 15, 2026

Copy link
Copy Markdown
Member

I think we should apply immediately https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Caching#heuristic_caching

But it may be challenging to parse the Last-Modified header. Maybe we could go simpler, w/ a short max-age (10min?) + consider the cache control is no-cache and only if the response contains either a Last-Modifed or an etag.

@mookums mookums force-pushed the cache-revalidation branch from 58c37f7 to f4db7c7 Compare June 15, 2026 14:20
@mookums

mookums commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Duration regression is from the cache tests being added to puppeteer. Any objections to just upping the average time in the CI test?

@krichprollsch

Copy link
Copy Markdown
Member

Duration is about puppeteer/cdp.js test only. Your change shouldn't have an impact on it, cache is not enable 🤔

@krichprollsch krichprollsch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is another comment from Claude about DeferredLayer (lines are outdated)
Not sure if it's correct r not 🤔

  • DeferringLayer doesn't propagate .handled — its deferred-replay paths (DeferringLayer.zig:283- and :333-) only branch on .abort vs not, treating .handled like .proceed. If a CacheLayer 304 (.handled) ever sits inside a DeferringLayer, the replay would forward header and continue replaying data/done, double-forwarding. Likely not a current combination, but the asymmetry is a latent trap.

Comment thread src/network/layer/Forward.zig Outdated
Comment thread src/network/cache/FsCache.zig Outdated
Comment thread src/network/layer/CacheLayer.zig Outdated
Comment thread src/network/cache/Cache.zig Outdated
@krichprollsch

Copy link
Copy Markdown
Member

I think we are good to merge. Anything to change from your POV @karlseguin?

@karlseguin

Copy link
Copy Markdown
Collaborator

@krichprollsch LGTM

@krichprollsch krichprollsch merged commit 8060390 into main Jun 18, 2026
23 checks passed
@krichprollsch krichprollsch deleted the cache-revalidation branch June 18, 2026 09:46
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants