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

best-quill-79210

03/04/2023, 6:11 PM
Hey, I'm reading the code for java sdk and see a class called
GBFeaturesRepository
It seems to implement caching and refreshing features at a defined interval. But there is no mention of this in docs and it seems incomplete in the sense where I'm unable to find the usages of
refreshCallbacks
array and implementation of `FeatureRefreshCallback`interface. Can someone help me in understanding this and should I use this class or manually fetch the features and pass to the constructor? Thanks in advance for help
f

future-teacher-7046

03/04/2023, 6:12 PM
b

best-quill-79210

03/05/2023, 5:38 PM
understood, but then repo maintains its own feature set and context maintains its own feature set which are different. So I should manually update the context feature by using the featureRefreshCallback? or else I'll never know when the poll ends and features are always stale. I think this should be automatically handled by the SDK itself
f

future-teacher-7046

03/06/2023, 6:45 PM
Is this for Android or server-side Java? For server-side, we recommend creating a new Context for every incoming request. The context has targeting attributes unique to the request/user so this approach keeps the code much simpler. When the feature repository updates, any new Context objects created after that point will pick up the new features. You likely don't want feature values to change half way through a single HTTP request anyway.
15 Views