Hey you all; I need some help :3 What are some be...
# contributing
q
Hey you all; I need some help :3 What are some best practices for configuring CDN caching when using GrowthBook for experimentation? Are there any specific settings or configurations that we should be aware of to ensure that experiment variations are properly cached and displayed to our users?
f
Hi Pedro - it depends a lot on your specific goals. You can set a long cache and use server send events to expire it (like our proxy does) or use a webhook. You can also just set a shortish TTL and let new experiments/flags expire within that time.
q
Hey Graham, thank you for your answer. What do you guys recommend to ensure that cached variations do not leak across experiments or between users? Cookies?
f
GrowthBook uses deterministic hashing, so as long as your hashing attribute is the same, they’ll get the same variation - how you store that ID is up to you, typically its from a cookie, but not managed by us (or you, really) - often it comes from GA or the event tracker
❤️ 1
q
Hey Graham, is there a way to get this hash?
f
From the SDK?
q
From the SDK?
Yep.
f
No, I don’t think it’s exposed in the eval features
But you can run the hashing fn yourself if you need the number
q
Thank you so much for your answer and attention, Graham.
@fresh-football-47124 getting back with the subject. I was thinking of using the polyfill to set the featureFlags at the cookie and use it to cache at CDN (https://docs.growthbook.io/lib/js#nodejs) Using it, we would have the CDN caching it through the
gbFeaturesCache
. The CDN will deliver then the static files cached (already rendered on the server with the experiments) to whoever needs them. What do you think? By the way, we are using nextjs.