Skip to content

Commit 4deb64f

Browse files
committed
Add worker
1 parent 13ec255 commit 4deb64f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,27 @@ Despite this limitation, an index can be built using [Workers](https://developer
1414
<source media="(prefers-color-scheme: light)" srcset="./cache-tag-light.svg">
1515
<img alt="Architecture Diagram" src="./cache-tag-light.svg">
1616
</picture>
17+
18+
This application is broken up into three [Workers](https://developers.cloudflare.com/workers/), three
19+
[Queues](https://developers.cloudflare.com/queues/), and one [D1](https://developers.cloudflare.com/d1/) database.
20+
21+
### Workers
22+
23+
#### [Watcher](./workers/watcher/)
24+
25+
This worker watches requests to the Cloudflare Cache / Origin, captures the tags, and sends them to the
26+
[Controller](./workers/controller/) in order to be persisted.
27+
28+
> [!IMPORTANT]
29+
> By the time a response from an origin reaches a [Worker](https://developers.cloudflare.com/workers/), Cloudflare
30+
> has already swallowed the `Cache-Tag` header and it is not longer available. To get around this, the worker reads the
31+
> custom `X-Cache-Tag` header instead.
32+
33+
The worker also exposes a `/.cloudflare/purge` endpoint that allows tags to be purged. This endpoint matches the
34+
[interface of the Cloudflare endpoint](https://developers.cloudflare.com/api/operations/zone-purge#purge-cached-content-by-tag-host-or-prefix), but only allows `tags`. The tags that are purged will be scoped
35+
to the zone in which the request is made too. For example, a purge request to `https://example.com/.cloudflare/purge`
36+
would only purge resources from the `example.com` zone.
37+
38+
- [Watcher](./workers/watcher/)
39+
- [Controller](./workers/controller/)
40+
- [Handler](./workers/handler/)

0 commit comments

Comments
 (0)