From e80c48bc17852cba691efbb22d5cb91d700754ac Mon Sep 17 00:00:00 2001 From: Bereket Engida Date: Sun, 27 Oct 2024 16:44:42 +0300 Subject: [PATCH] docs: improve cookie cache docs --- .../docs/concepts/session-management.mdx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/content/docs/concepts/session-management.mdx b/docs/content/docs/concepts/session-management.mdx index 9c95555107..c8340679d7 100644 --- a/docs/content/docs/concepts/session-management.mdx +++ b/docs/content/docs/concepts/session-management.mdx @@ -120,4 +120,21 @@ const auth = new BetterAuth({ }); ``` -This setup reduces database calls while keeping session data reasonably fresh and secure. \ No newline at end of file +If you want to disable returning from the cookie cache when fetching the session, you can pass `disableCookieCache:true` + +```ts title="client.ts" +const session = await authClient.getSession({ query: { + disableCookieCache: true +}}) +``` + +or on the server + +```ts title="server.ts" +auth.api.getSession({ + query: { + disableCookieCache: true, + }, + headers: req.headers, // pass the headers +}); +```