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!: Replace prefetch behavior with simple TTL cache #786

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

keelerm84
Copy link
Member

Previously, the LDClient would issue a call to prime the store with
data, which would be retained for the lifetime of the variation or all
flags call.

This priming call is being removed in favor of a simple TTL cache. The
cache will be populated on the initial usage of the SDK, and then
periodically as it is detected to be expired.

The TTL can be configured with:

  • Positive value representing the time to cache the value
  • 0 to cache the value indefinitely. This allows a customer to
    initialize the SDK within an EdgeWorker handler, and get a "snapshot"
    of the view for the lifetime of the SDK.
  • Negative value representing no cache. This value is highly discouraged
    as usage restrictions in Akamai make it ineffective.

@keelerm84 keelerm84 requested a review from a team as a code owner February 21, 2025 16:32
Copy link
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Size: 19014 bytes
Size limit: 21000

Copy link
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Size: 15371 bytes
Size limit: 20000

Copy link
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Size: 19871 bytes
Size limit: 21000

Previously, the LDClient would issue a call to prime the store with
data, which would be retained for the lifetime of the variation or all
flags call.

This priming call is being removed in favor of a simple TTL cache. The
cache will be populated on the initial usage of the SDK, and then
periodically as it is detected to be expired.

The TTL can be configured with:

- Positive value representing the time to cache the value
- 0 to cache the value indefinitely. This allows a customer to
  initialize the SDK within an EdgeWorker handler, and get a "snapshot"
  of the view for the lifetime of the SDK.
- Negative value representing no cache. This value is highly discouraged
  as usage restrictions in Akamai make it ineffective.
@keelerm84 keelerm84 force-pushed the mk/sdk-1075/json-decoding branch from 6eb196a to cfe2a73 Compare February 21, 2025 16:34
@keelerm84 keelerm84 requested a review from kinyoklion February 21, 2025 20:40
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.

3 participants