Added support for sessionStorage for cache. #194
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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.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