Closed khurram18 closed 10 months ago
Hi @khurram18 - thanks for creating the feature request. We do already have a TTL/expiry feature request open so I'm going to close this one as a duplicate and we can keep the context in #142. This feature is not on our immediate roadmap though.
Use case
The cache should be able to expire after a certain time. Currently the implementation of cache i.e
InMemoryNormalizedCache
will retain its content as long as it is valid.The modern iOS devices have enough memory to retain almost all of the app state(views, models etc) and restore them when app come to foreground again from background. In those cases when a new query is initiated it will definitely hit the cache but the cached content might not be accurate for user(for example a sport game score might be changed after some time).
I understand that the behaviour can be achieved outside the SDK but having a time based cache inside the SDK will be a nice feature.
Describe the solution you'd like
Be able to specify an expiry time in cache who ever needs a time expiring cache. For the default behaviour the current implementation is sufficient.