mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-26 17:06:41 -05:00
docs: improve cookie cache docs
This commit is contained in:
@@ -120,4 +120,21 @@ const auth = new BetterAuth({
|
||||
});
|
||||
```
|
||||
|
||||
This setup reduces database calls while keeping session data reasonably fresh and secure.
|
||||
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
|
||||
});
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user