Cache Reader Worker

This worker READS from the cache. The cache-writer worker should have written to it first.

Testing if Cache API is shared between two workers on the same account.

Quick Test

Run all tests to check if any cache type is shared:

Run All Tests Self Test (verify Cache API works)

Individual Read Tests

First, go to Cache Writer and write to each cache type.

Test 1: caches.default (internal URL)

Try to read what writer stored in caches.default

Read from Default Cache

Test 2: caches.open('shared-cache')

Try to read what writer stored in the named cache

Read from Named Cache

Test 3: caches.default (zone URL)

Try to read using this worker's zone URL as the cache key

Read from Zone URL Cache

How This Works

Cache Type Cache Key URL Hypothesis
caches.default https://shared-cache-test.internal/KEY Probably NOT shared - internal URL doesn't match zone
caches.open('name') https://shared-named-cache.internal/KEY Unknown - might be per-account or per-worker
caches.default (zone) https://cache-reader.erfianugrah.com/cached/KEY Most likely to work - uses same zone URL

Why This Matters

If cache IS shared:

If cache is NOT shared:

THE TEST: Writer caches, Reader just fetches

Does Writer's Cache API serve cached responses to Reader?

Writer uses Cache API to cache. Reader does plain fetch(). Does reader get cached response?

Run Full Test (clears cache first)

Single fetch:

Fetch from Writer (once)

Links

Go to Cache Writer | Go to Cache Edge (cross-account test)