https://www.growthbook.io/ logo
#announcements
Title
# announcements
e

enough-camera-24490

03/13/2023, 3:10 PM
What sort of caching do the javascript based SDKS do? There is a section called Built-in Fetching and Caching, but no information about how the caching actually works.
h

happy-autumn-40938

03/13/2023, 5:48 PM
Out of the box, built in caching will include: a. In memory cache, which avoids extra lookups within a given SDK session b. window.localStorage, to persist cache across browser sessions If you are using the SDK in a backend context, you can provide your own polyfill for localStorage and route it to use a cache system of your choosing.
1
Specific cache strategy uses a stale-while-revalidate approach, with the default stale timeout being 60 seconds. You can override this using SDK's exported function
configureCache
Copy code
const { configureCache } = require("@growthbook/growthbook");

// after SDK is initialized, optional fields:
configureCache({
  backgroundSync: true;
  cacheKey: "somethingElse";
  staleTTL: 3600;
})
1
e

enough-camera-24490

03/13/2023, 7:29 PM
Appreciate the quick response!
16 Views