Trail-Sense icon indicating copy to clipboard operation
Trail-Sense copied to clipboard

Create an async version of shared prefs

Open kylecorry31 opened this issue 2 years ago • 0 comments

In almost all (if not all) cases, I am not writing and directly reading a preference.

Therefore, I should be able to extend the cached preference to do the following:

  • Asynchronously get all prefs when initially loaded
  • Fall back to synchronous get when no cache hit (ex. before it is loaded / reloaded)
  • On preference change, invalidate the cache for that pref + asynchronously reload the preference into cache

If the preference load is done on startup, in the background this should mean that most preference loads are cache hits.

  • [ ] Update CachedPreferences to preload all preferences (preload flag)
  • [ ] Update CachedPreferences to reload preference after it's changed
  • [ ] Verify performance improvement
  • [ ] Move GPS/steps cache to separate shared prefs

kylecorry31 avatar Jul 29 '23 22:07 kylecorry31