-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/packages
#5210Labels
⏳Bot is counting down the days until it unassigns the issueBot is counting down the days until it unassigns the issueP3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityp: shared_preferencesPlugin to read and write Shared PreferencesPlugin to read and write Shared Preferencespackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Description
Based on discussion while adding prefix support to shared_preferences, and previous discussion in #101691, we should consider deprecating the current API and building a new API with the cache outside the public API instead of inside its implementation.
This version could consist of two different public API layers:
- Setters and getters that are all async, and are direct passthroughs to the underlying storage. Prefixing would be fully optional.
- We could either make it not part of this layer at all, leaving it entirely to clients of this API layer, or we could allow creating arbitrary instances with optional prefixes. (Since there is no singleton+cache at this layer, we would not have to worry about cache consistency issues.)
- A separate cache object, with an API more like the current API, built on the underlying async API. We could:
- have no "shared instance" logic at all (leaving it entirely to clients to manage their cache instances), or
- build in something more flexible than the current singleton. E.g., maybe allow something like a global ID-keyed map, where you would ask for an instance with certain properties (such as key prefix) and you'd get a key back that you could use to access that same shared instance in the future. In this version we'd need to make it very clear that the caches would be distinct, and strongly discourage overlapping caches (e.g., a no-prefix cache and a prefixed cache) to avoid synchronization issues.
We'd want to fully evaluate all the flexibility we'd need to meet open requests (different storage files/domains, etc.) before designing the new API so we could incorporate all of it up front in at least layer 1.
(@tarrinneal just capturing based on recent thoughts and discussions while it's fresh in our minds; not something we need to do in the short term.)
atrope, mono0926, mraaz97, jlavyan, VigneshVeerasamy and 73 moreditman, atrope and RoarGronmo
Metadata
Metadata
Assignees
Labels
⏳Bot is counting down the days until it unassigns the issueBot is counting down the days until it unassigns the issueP3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityp: shared_preferencesPlugin to read and write Shared PreferencesPlugin to read and write Shared Preferencespackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team