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: docs/guide/caching.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -151,10 +151,13 @@ request.Headers.CacheControl = new CacheControlHeaderValue
151
151
152
152
## Sharing a Cache Store
153
153
154
-
By default each named client gets its own `CacheStore`. To share a single store across multiple named clients — for example, to deduplicate in-flight requests across services — create a `CacheStore` once and pass it directly:
154
+
By default each named client gets its own cache. To share a single store across multiple named clients — for example, to serve the same cached responses to parallel services — implement `ICacheStore`and pass the same instance to each client:
Copy file name to clipboardExpand all lines: docs/guide/cookies.md
+18-26Lines changed: 18 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,39 +107,31 @@ A cookie with no `Max-Age` and no `Expires` is a **session cookie** — it lives
107
107
Set-Cookie: sid=abc123 ← no expiry: lasts until the client is disposed
108
108
```
109
109
110
-
## Working with `CookieJar` Directly
110
+
## Sharing a Cookie Store
111
111
112
-
`CookieJar` is a public class. You can construct one independently to pre-populate cookies, test cookie matching logic, or share a jar across request processing outside the pipeline.
112
+
By default each named client gets its own isolated cookie store. To share cookies across multiple clients — for example, so that a login performed by one client is visible to another — implement `ICookieStore` and pass the same instance to each:
Call `Clear()` on the jar when a user logs out to remove all stored cookies:
139
-
140
-
```csharp
141
-
// After a successful logout response:
142
-
jar.Clear();
143
-
```
133
+
A cookie set during login on the `auth` client will now be available to the `api` client.
144
134
145
-
Since the per-client `CookieJar` is managed internally by the pipeline, clearing it in tests or custom integrations requires direct access to the jar instance used at construction time.
135
+
::: warning Thread safety
136
+
When an `ICookieStore` is shared across multiple clients it will receive concurrent reads and writes. Your implementation must be thread-safe.
0 commit comments