Skip to content

Commit e34b872

Browse files
authored
docs: document the options of interceptors.cache() (#6050)
1 parent e8f3423 commit e34b872

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

‎docs/docs/api/Interceptors.md‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,21 @@ backing store.
341341
342342
**Parameters**
343343
344-
* `opts` {CacheHandler.CacheOptions} (optional) See the
345-
[`CacheStore`](./CacheStore.md) documentation for accepted fields.
344+
* `opts` {Object} (optional)
345+
* `store` {CacheStore} The store that cached responses are kept in. See
346+
[`CacheStore`](./CacheStore.md). **Default:** a new `MemoryCacheStore`.
347+
* `methods` {string[]} The HTTP methods to cache. Only safe methods are
348+
allowed (`GET`, `HEAD`, `OPTIONS`, `TRACE`) and at least one is required.
349+
**Default:** `['GET']`.
350+
* `cacheByDefault` {number} RFC 9111 allows caching responses that are not
351+
explicitly marked as cacheable or not cacheable. Set this to cache such
352+
responses. **Default:** `undefined`.
353+
* `type` {string} Whether the cache is `'shared'` or `'private'`, which
354+
decides how directives such as `s-maxage` and `private` are applied.
355+
**Default:** `'shared'`.
356+
* `origins` {(string|RegExp)[]} Only requests to these origins are cached.
357+
Strings are compared case-insensitively. **Default:** `undefined` (all
358+
origins are cached).
346359
347360
**Returns:** {Dispatcher.DispatcherComposeInterceptor}
348361

0 commit comments

Comments
 (0)