When setting a custom stalePeriod on web, the cache remains valid and the browser will access data via the cache rather than sending out a fresh network request, even when the Duration specified in stalePeriod has expired.
Expected behaviour
On all platforms, after a custom stalePeriod is set, items should be removed from the cache after the specified Duration has expired.
Reproduction steps
Extend CacheManager with a Config(...stalePeriod: Duration(minutes: 1)
Make a request that uses the CacheManager
Wait over one minute
Make the same request again
Observe that the second request hits the cache, not the web.
🐛 Bug Report
When setting a custom
stalePeriod
on web, the cache remains valid and the browser will access data via the cache rather than sending out a fresh network request, even when the Duration specified instalePeriod
has expired.Expected behaviour
On all platforms, after a custom
stalePeriod
is set, items should be removed from the cache after the specified Duration has expired.Reproduction steps
CacheManager
with aConfig(...stalePeriod: Duration(minutes: 1)
Observe that the second request hits the cache, not the web.
Configuration
Version: 3.3.0
Platform:
Cause
By default, the config for web uses the NonStoringObjectProvider. Old cache objects are removed using their provider's getOldObjects method. The implementation of this in the NonStoringObjectProvider never does anything.
Ideally, the web config should be update to use a repo that has a working implementation of
getOldObjects
.