swift-graphql
swift-graphql copied to clipboard
Caching
Is Caching via the CachExchange
supposed to be working? It seems it's not.
Looking into the code, the caching uses Operation.id
as a key, but that id is a random UUID every time a query is created by the client.
The tests around CacheExchange always use stable id's which is why the tests pass.
Are my assumptions correct and would some changes need to be made to get caching working, or am I holding it wrong in some way?
(Reacting with thumb up as it never worked for me as well, would be happy if it was resolved).
Out of curiosity why do you want this library to do any caching? Personally I prefer when a library doesn't enforce specific caching strategies unless it's a full-fledged feature with a lot more control.
Generally I prefer the library to be more predictable, i.e. every call to an API should result in the same expectation.
Caching makes this more difficult as it abstracts away 'some' details as to why (and what) is exactly returned.
I have been wondering for a while whether this is something we should even be doing tbh.
Would love to hear other perspectives on this.