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

Better localStorage space management #310

Open
romulof opened this issue Nov 15, 2024 · 1 comment
Open

Better localStorage space management #310

romulof opened this issue Nov 15, 2024 · 1 comment

Comments

@romulof
Copy link

romulof commented Nov 15, 2024

Is your feature request related to a problem? Please describe.

LD SDK shares localStorage space with our app, and there is no constrain on how much data LD SDK can use, leading to unexpected localStorage quota issues.

Describe the solution you'd like

  • LD SDK to have a configuration of how many kB could be allocated for cache
  • Optionally use some compression algorithm to save some space

Describe alternatives you've considered

I had to write a procedure for my app init to cleanup old LD cache entries, because I was running out of quota, or simply turn off localStorage cache, slowing down my application.

Additional context

N/A

@kinyoklion
Copy link
Member

Hello @romulof,

Thank you for the recommendation. I agree that the SDK shouldn't be unconstrained as it is now.

Our general strategy for this across the SDKs is having a cached context control. By default it does 5 contexts and can be adjusted. It doesn't handle things on the kB level, but the size of the cache for any given context cannot be known ahead of time, so potentially you may have a quota that allows no caching.

We are working on a replacement for this SDK: https://github.com/launchdarkly/js-core/tree/main/packages/sdk/browser

The feature: https://launchdarkly.github.io/js-core/packages/sdk/browser/docs/interfaces/LDOptions.html#maxCachedContexts

If your workaround works in the medium-term, then we should be able to have the new SDK released to resolve the issue.

Generally speaking caching will work different.

Thank you,
Ryan

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

No branches or pull requests

2 participants