Skip to content

Added support for sessionStorage for cache. #194

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

Conversation

elliotcourant
Copy link

@elliotcourant elliotcourant commented Dec 5, 2019

This adds support for specifying localStorage or sessionStorage when
bootstrapping the LD JS client. This can be used if the user's hash
changes frequently and can cause a build-up of old records in the
client's local storage by instead storing data in the session storage.

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Describe the solution you've provided

This adds support for being able to specify sessionStorage when initializing the LD client. We were running into a problem where user's who were frequently signing in and out would build up several different caches for LD in local storage and had to clear them out manually.

image

So help improve this going forward this adds support for sessionStorage as an option for LD's cache, which will clear out cached items once the session is over rather than letting them build up.

Describe alternatives you've considered

This is the solution that my team and I came up with given the use case. There might be other approaches to solve the problem and I welcome any and all feedback.

Additional context

This merge request also has a dependency on launchdarkly/js-sdk-common#2

This adds support for specifying localStorage or sessionStorage when
bootstrapping the LD JS client. This can be used if the user's hash
changes frequently and can cause a build-up of old records in the
client's local storage by instead storing data in the session storage.
@elliotcourant elliotcourant force-pushed the feature/session-storage branch from 07027f1 to ca768cb Compare December 5, 2019 22:00
@eli-darkly
Copy link
Contributor

Please see my comments on the js-sdk-common PR. This browser-specific part of the code looks fine but I'm still a little uncertain about the overall approach.

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