You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/workers/runtime-apis/cache.mdx
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ let cache = caches.default;
43
43
awaitcache.match(request);
44
44
```
45
45
46
-
You may create and manage additional Cache instances via the [`caches.open`](https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage/open) method.
46
+
You may create and manage additional Cache instances via the [caches.open](https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage/open) method.
47
47
48
48
```js
49
49
let myCache =awaitcaches.open('custom:cache');
@@ -115,10 +115,10 @@ The `stale-while-revalidate` and `stale-if-error` directives are not supported w
115
115
116
116
*`request` string | Request
117
117
118
-
* Either a string or a [`Request`](/workers/runtime-apis/request/) object to serve as the key. If a string is passed, it is interpreted as the URL for a new Request object.
118
+
* Either a string or a [Request](/workers/runtime-apis/request/) object to serve as the key. If a string is passed, it is interpreted as the URL for a new Request object.
119
119
120
120
*`response` Response
121
-
* A [`Response`](/workers/runtime-apis/response/) object to store under the given key.
121
+
* A [Response](/workers/runtime-apis/response/) object to store under the given key.
122
122
123
123
124
124
@@ -127,7 +127,7 @@ The `stale-while-revalidate` and `stale-if-error` directives are not supported w
127
127
`cache.put` will throw an error if:
128
128
129
129
* The `request` passed is a method other than `GET`.
130
-
* The `response` passed has a `status` of [`206 Partial Content`](https://www.webfx.com/web-development/glossary/http-status-codes/what-is-a-206-status-code/).
130
+
* The `response` passed has a `status` of [206 Partial Content](https://www.webfx.com/web-development/glossary/http-status-codes/what-is-a-206-status-code/).
131
131
* The `response` passed contains the header `Vary: *`. The value of the `Vary` header is an asterisk (`*`). Refer to the [Cache API specification](https://w3c.github.io/ServiceWorker/#cache-put) for more information.
132
132
133
133
#### Errors
@@ -162,7 +162,7 @@ The `stale-while-revalidate` and `stale-if-error` directives are not supported w
162
162
163
163
*`request` string | Request
164
164
165
-
* The string or [`Request`](/workers/runtime-apis/request/) object used as the lookup key. Strings are interpreted as the URL for a new `Request` object.
165
+
* The string or [Request](/workers/runtime-apis/request/) object used as the lookup key. Strings are interpreted as the URL for a new `Request` object.
166
166
167
167
*`options`
168
168
* Can contain one possible property: `ignoreMethod` (Boolean). When `true`, the request is considered to be a `GET` request regardless of its actual value.
@@ -229,7 +229,7 @@ The `cache.delete` method only purges content of the cache in the data center th
229
229
230
230
*`request` string | Request
231
231
232
-
* The string or [`Request`](/workers/runtime-apis/request/) object used as the lookup key. Strings are interpreted as the URL for a new `Request` object.
232
+
* The string or [Request](/workers/runtime-apis/request/) object used as the lookup key. Strings are interpreted as the URL for a new `Request` object.
233
233
234
234
*`options` object
235
235
* Can contain one possible property: `ignoreMethod` (Boolean). Consider the request method a GET regardless of its actual value.
@@ -241,6 +241,6 @@ The `cache.delete` method only purges content of the cache in the data center th
241
241
## Related resources
242
242
243
243
*[How the cache works](/workers/reference/how-the-cache-works/)
244
-
*[Example: Cache using `fetch()`](/workers/examples/cache-using-fetch/)
244
+
*[Example: Cache using fetch()](/workers/examples/cache-using-fetch/)
245
245
*[Example: using the Cache API](/workers/examples/cache-api/)
246
246
*[Example: caching POST requests](/workers/examples/cache-post-request/)
0 commit comments