|
|
|
|
|
by arnorhs
2886 days ago
|
|
you should take a look at the caching policies (fetch policy) apollo client provides as well as the error policy. neither are easy to find for the error policy, you basically control the behavior (for each client instance or each request) when a request is considered failed. none, ignore and all. [1] fetch policy allows you immense control over caching. this all depends on what you're doing but in some instances it can even make sense to never cache any requests, depending on how you application is structured. the docs are hard to google for this, but here's a link for you [2] [1] https://www.apollographql.com/docs/react/features/error-hand... [2] https://www.apollographql.com/docs/react/api/react-apollo.ht... |
|
It's just really annoying that I have a ton of queries that return lists of objects, where each object has an easily known expiration time, and there's no way to say, "cache this result but remove the elements that have expired". I can't even say, "cache this list until X time", which would be very easy in a RESTful environment. I know there are extensions to support caching but none of them are universal yet. I'm hopeful that the community will land on an answer for object level cache expiration.