clean-answer-9369608/30/2023, 6:33 AM
Question: So let's say my app started I called gb.load_features() and after 5 minutes I went and update configuration of a feature, will growthbook sdk know to get an update or is it trusting me to keep call gb.load_features() periodically?
gb = GrowthBook( api_host = "<https://cdn.growthbook.io>", client_key = "sdk-abc123", # How long to cache features in seconds (Optional, default 60s) cache_ttl = 60, ) gb.load_features()
happy-autumn-4093808/30/2023, 7:32 AM
limited-ram-7754408/30/2023, 2:41 PM
is set to
happy-autumn-4093808/30/2023, 5:05 PM
before the TTL expires, the SDK will just used the cached copy instead of fetching new features. You can override the TTL to not be 60 seconds, ex:
. However, without streaming, the SDK will keep stale results indefinitely until something triggers a refetch (i.e. a user triggering another
call). With streaming enabled, none of this matters because the SDK will get instant feature updates from the server, which bypasses the cache/TTL logic entirely and re-seeds your SDK cache.