Repository navigation
perf: edge-cache via caches.default in middleware - #14
Merged
neuromechanist merged 1 commit intoMay 18, 2026
Merged
neuromechanist merged 1 commit into
neuromechanist merged 1 commit into
Conversation
neuromechanist
force-pushed
the
feature/issue-1-perf-cache-middleware
branch
from
May 18, 2026 08:16
87cf429 to
44283d6
Compare
Deploying nemar-website with
|
| Latest commit: |
44283d6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://05cf53cc.nemar-website.pages.dev |
| Branch Preview URL: | https://feature-issue-1-perf-cache-m.nemar-website.pages.dev |
neuromechanist
merged commit May 18, 2026
94a7394
into
feature/issue-1-epic-nemar-redesign
1 check passed
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
src/middleware.tsthat talks directly to the Cloudflare Workers Cache API (caches.default-equivalent viacaches.open(\"nemar-edge-v1\")).Why
Cloudflare's automatic CDN cache honors
Cache-Control: s-maxageon production custom domains but skips caching on*.pages.devpreview URLs (and on some short-cached responses). This middleware closes that gap so:Pairs with the
Cache-Controlheaders landed in 1879a96.What it does
x-nemar-cache: HIT.next(), store the response ifCache-Controlispublic+(max-age|s-maxage)=N, and tag the response withx-nemar-cache: MISS.runtime.ctx.waitUntilwhen available so the cache write doesn't block the response.no-store/private.Test plan
/dataset/<id>showsx-nemar-cache: MISSand normal TTFB.s-maxagewindow showHITand dramatically lower TTFB./discover?modality=eegand/discover?modality=megget separate cache entries (URL keying).