@cloudflare/workers-response-store 0.1.0-beta.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +7 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -123,8 +123,11 @@ export default {
123
123
  return render(request, env, ctx);
124
124
  }
125
125
 
126
- // Cache identity is pathname + query string. Use a canonical GET request
127
- // with only information that is safe to share between visitors.
126
+ // Cache identity is the key's pathname + query string. Use a canonical GET
127
+ // request with only information that is safe to share between visitors.
128
+ // This minimal sample keeps the full query, so every query variant gets its
129
+ // own entry. Leave out query parameters the response doesn't depend on, so
130
+ // requests that differ only in them share one entry.
128
131
  const cacheRequest = new Request(request.url);
129
132
  const cached = await responseStore.fetch(cacheRequest);
130
133
  if (!isResponseStoreMiss(cached)) {
@@ -192,9 +195,10 @@ type ResponseStoreMutationResult = {
192
195
  ### Cache keys
193
196
 
194
197
  - Keys must be `GET` requests.
195
- - Identity is the URL pathname plus query string; scheme and host are ignored.
198
+ - Identity is the key URL's pathname plus query string; scheme and host are ignored. The key doesn't have to be the visitor's URL.
196
199
  - Every key stores its response and read metadata together in one version-scoped R2 object by default, so fresh hits and misses do not query the metadata Durable Object. No special key format is required.
197
200
  - Build the key from trusted route and vary data. Do not include arbitrary visitor headers or other unbounded input unless it intentionally creates a distinct shared response.
201
+ - Leave out query parameters the response doesn't depend on, so requests that differ only in them share one entry.
198
202
 
199
203
  ### Freshness and tags
200
204
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/workers-response-store",
3
- "version": "0.1.0-beta.2",
3
+ "version": "1.0.0",
4
4
  "description": "An R2-backed programmatic response store for Cloudflare Workers.",
5
5
  "homepage": "https://vinext.dev/",
6
6
  "license": "MIT",