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

feat: Update caching strategy to allow for greater cache use #404

Merged
merged 2 commits into from
Aug 7, 2024

Conversation

keelerm84
Copy link
Member

Instead of indexing by the full context's hash, we are going to revert to indexing by canonical key. The cache will store the hash alongside the flag values.

This stored hash will be compared with the active context hash when the cache is read. If the hashes are different, the SDK will fetch updated values. If they haven't changed, then the SDK is free to wait until the cache freshness has exceeded the configured polling interval.

As a result, the SDK should have a smoother transition from

default -> last known values -> fresh values

as the context changes while also minimizing unnecessary API requests.

Instead of indexing by the full context's hash, we are going to revert
to indexing by canonical key. The cache will store the hash alongside
the flag values.

This stored hash will be compared with the active context hash when the
cache is read. If the hashes are different, the SDK will fetch updated
values. If they haven't changed, then the SDK is free to wait until the
cache freshness has exceeded the configured polling interval.

As a result, the SDK should have a smoother transition from

    default -> last known values -> fresh values

as the context changes while also minimizing unnecessary API requests.
@keelerm84 keelerm84 requested a review from a team as a code owner August 7, 2024 14:19
@keelerm84 keelerm84 merged commit 62587ad into v9 Aug 7, 2024
4 checks passed
@keelerm84 keelerm84 deleted the mk/sc-252287/cache-improvements branch August 7, 2024 20:57
keelerm84 pushed a commit that referenced this pull request Aug 7, 2024
🤖 I have created a release *beep* *boop*
---


##
[9.10.0](9.9.0...9.10.0)
(2024-08-07)


### Features

* Update caching strategy to allow for greater cache use
([#404](#404))
([62587ad](62587ad))


### Bug Fixes

* Sort private attributes for improved stable encoding
([#401](#401))
([90bf896](90bf896))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: LaunchDarklyReleaseBot <LaunchDarklyReleaseBot@launchdarkly.com>
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.

2 participants