Closed valeriyo closed 4 years ago
Hi @valeriyo,
Without more details about your use of the SDK we won't be able to track down any specific bug related to the feature flag cache. I'll go ahead and clarify the behavior so we can determine whether your experience is expected behavior or not.
We've very rarely updated the schemas of the internal flag value cache, the only times I'm aware of us updating the format since the 2.0.0 release (back in 2017) has been in releases 2.6.0 and 2.7.0. Since these releases, the SDK has contained migration code to automatically update the flag value cache format during initialization to avoid losing the cached values.
There is one expected reason that the SDK would dropped the cached flag values for a user, which is a feature that removes the cache for the least recently used user when the number of cached users exceeds a maximum. This feature is to prevent unbounded cache size growth. This limit is per environment, and a cache is stored per user indexed by the user's key
. Originally this limit was 5 users and not configurable, but the 2.12.0 release introduced the ability to change this limit (or set it to be unlimited).
Additionally, it's possible for the cache to be deleted if the user clears the application data or uninstalls and reinstalls the application.
I hope you find this explanation valuable. If your experience still seems to be unexpected behavior, please reach out here or to our support team with more information about the behavior so we can track down the issue.
Thanks, @gwhelanLD
I'm closing this issue, but if you believe there to be a specific issue here feel free to reopen the issue.
Thanks, @gwhelanLD
The LD library caches fetched feature flags locally, so that next time app starts up without network connection, the feature flags are known. Unfortunately, it seems that sometimes the cache is discarded (there must be some internal condition that invalidates the cache) and if there is no connectivity - users see that features they saw previously, disappear. I am not sure what those cache-invalidation conditions/events are (I haven't studied the library code, perhaps, it's schema changes of the serialized data in files) but there seems to be a wrong invalidation occurring when flags are lost without replacement.
This makes it impossible to use Launchdarkly for user-facing features, because it would be unacceptable for regular customers to see that all features disappeared all of a sudden.