Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Associated time that given fields/entire cache was last updated #472

Open
paulieDOTjs opened this issue Sep 29, 2022 · 1 comment

Comments

@paulieDOTjs
Copy link

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.

@wodCZ
Copy link
Collaborator

wodCZ commented Sep 30, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants