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: deps/undici/src/docs/docs/api/CacheStore.md
+16-3Lines changed: 16 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,10 +66,12 @@ Parameters:
66
66
Returns: `GetResult | Promise<GetResult | undefined> | undefined` - If the request is cached, the cached response is returned. If the request's method is anything other than HEAD, the response is also returned.
67
67
If the request isn't cached, `undefined` is returned.
68
68
69
+
The `get` method may return a `Promise` for async cache stores (e.g. Redis-backed or remote stores). The cache interceptor handles both synchronous and asynchronous return values, including in revalidation paths (304 Not Modified handling and stale-while-revalidate background revalidation).
70
+
69
71
Response properties:
70
72
71
73
***response**`CacheValue` - The cached response data.
72
-
***body**`Readable | undefined` - The response's body.
74
+
***body**`Readable | Iterable<Buffer> | undefined` - The response's body. This can be an array of `Buffer` chunks (with a `.values()` method) or a `Readable` stream. Both formats are supported in all code paths, including 304 revalidation.
73
75
74
76
### Function: `createWriteStream`
75
77
@@ -98,8 +100,11 @@ This is an interface containing the majority of a response's data (minus the bod
98
100
99
101
### Property `vary`
100
102
101
-
`Record<string, string | string[]> | undefined` - The headers defined by the response's `Vary` header
102
-
and their respective values for later comparison
103
+
`Record<string, string | string[] | null> | undefined` - The headers defined by the response's `Vary` header
104
+
and their respective values for later comparison. Values are `null` when the
105
+
header specified in `Vary` was not present in the original request. These `null`
106
+
values are automatically filtered out during revalidation so they are not sent
107
+
as request headers.
103
108
104
109
For example, for a response like
105
110
```
@@ -116,6 +121,14 @@ This would be
116
121
}
117
122
```
118
123
124
+
If the original request did not include the `accepts` header:
125
+
```js
126
+
{
127
+
'content-encoding':'utf8',
128
+
accepts:null
129
+
}
130
+
```
131
+
119
132
### Property `cachedAt`
120
133
121
134
`number` - Time in millis that this value was cached.
0 commit comments