apollo-cache-persist
apollo-cache-persist copied to clipboard
Feature Request: Associated time that given fields/entire cache was last updated
At this time I am not seeing an easy to way to know how recent the data in the cache has been set.
It would be nice to have this information accessible through the API and/or an option such as stale-time
during the setup.
I am using a fetch-policy of "cache-first" for most of my queries. However, data that is more than a day/week/month old I would like to be able to purge.
I believe nothing has really changed at apollo-cache-persist's options regarding cache expiration since it was last discussed in #2 and #53.
Here a few mentions worth exploring:
If your main concern is avoiding the display of stale data, perhaps you could add an updatedAt field to the time-sensitive objects and avoid displaying if they're older than a specific threshold. (Slightly more hackily, you could add a fetchedAt field that the server just writes Date.now() into and use that for filtering.) (source)
I was looking at how to do this since many times you have data you don't control or know when to evict and found this article, I hope it is useful to others here. (source)
I'll leave the issue open now just to provide a space for a fresh discussion, although I don't believe it'll lead to an actual feature as the title is suggesting.