Back

How to disable appwrite's function cache in Next.js?

  • 1
  • General
  • Web
Zynth
3 Oct, 2024, 10:36
TypeScript
import { Databases, Query } from "node-appwrite";

...

const documents = await this.databases.listDocuments(
        databaseId,
        featureToggleCollectionId,
        [Query.equal("featureName", featureName)],
      );

This specific piece of code is returning cached results. How can we disable the cache that seem to be inside the appwrite dependency within my Next.js project?

Note that the surrounding code is** not cached** πŸ”₯

TL;DR
To disable appwrite's function cache in Next.js and prevent cached results, you can pass the `X-Fresh-Reading` header with a value of 1 to the Appwrite API. This will ensure that a new reading is fetched each time without resorting to cached data.
Zynth
3 Oct, 2024, 10:36

How to disable appwrite's function cache in Next.js?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more