Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GB-23 GB-24 Networking with the GBFeaturesRepository #16

Merged
merged 27 commits into from
Feb 14, 2023

Conversation

tinahollygb
Copy link
Contributor

@tinahollygb tinahollygb commented Feb 14, 2023

Adds networking via the new GBFeaturesRepository class, allowing developers to fetch both unencrypted and encrypted features.

An instance of this class can be created with an endpoint URL, TTL (seconds), and optional encryption key for decrypting encrypted payloads.

Features

  • Configure the refresh rate with ttlSeconds (defaults to 60)
  • gbFeaturesRepository.initialize() makes the network request to the GrowthBook SDK endpoint to get the features, and caches the response in-memory.
  • gbFeaturesRepository.getFeaturesJson() allows you to get the features JSON as a string, which simplifies the implementation of fetching and initializing a GBContext.
  • Appends the client and version number to the User-Agent header when fetching features, e.g. growthbook-sdk-java/0.3.0
  • Adds the ability to subscribe to a callback when features are refreshed with onFeaturesRefresh(FeatureRefreshCallback callback)

Issues

@linear
Copy link

linear bot commented Feb 14, 2023

GB-23 [Java SDK]: Implement feature repository that fetches and caches features in-memory

Initial GBFeatureRepository class.

Acceptance Criteria

  • ✅ should fetch features with provided endpoint and optional encryptionKey config.
  • ✅ expose method getFeaturesJson()
  • ✅ should send a user agent string to identify itself as the Java SDK with version

GB-24 [Java SDK]: Add caching with configurable TTL to the feature repository

The existing GBFeatureRepository class should be:

  • ✅ Configurable TTL for the caching
  • ✅ Have functionality to refresh the features when the cache has expired
  • ✅ Support a list of callbacks to allow implementations to listen for feature updates.

@tinahollygb tinahollygb merged commit e49bcc6 into main Feb 14, 2023
@tinahollygb tinahollygb deleted the tina/gb-23-java-sdk-implement-feature-repository branch February 14, 2023 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant