How to refresh cookie cache

Hey! I have a nextjs application and im mostly using client components to fetch user session.
I would like to use the BA cookie cache functionality to avoid querying the db for each session.

I can see the cookie cache is set whenever a user logs in.

However when the cookie cache duration expires it does not get reset in any way.

Is there a preferred way to reset the cookie cache?

here is my configuration:

  session: {
    expiresIn: 60 * 60 * 24 * 7, // 7 days
    updateAge: 60 * 60 * 24, // 1 day (every 1 day the session expiration is updated)
    freshAge: 5 * 60, // 5 minutes
    cookieCache: {
      enabled: true,
      maxAge: 5 * 60, // Cache duration in seconds
    },
  },
  advanced: {
    cookiePrefix: "myapp",
    crossSubDomainCookies: {
      enabled: true,
      domain: `.${baseHost}`,
    },
    defaultCookieAttributes: {
      sameSite: process.env.NODE_ENV === "production" ? "none" : "lax",
      secure: process.env.NODE_ENV === "production",
      httpOnly: true,
    },
  },
  trustedOrigins: [`*.${baseHost}`],


im only fetching the session client side. const { data, isPending } = authClient.useSession()
Was this page helpful?