What sort of caching do the javascript based SDKS ...
# announcements
e
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
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
Appreciate the quick response!