2 ms·
> For crying out loud, one of the "solutions" for caching is to actually parse both the incoming and the outgoing requests, read the fields and decide if it nee
by Aeolun 7y ago
> For crying out loud, one of the "solutions" for caching is to actually parse both the incoming and the outgoing requests, read the fields and decide if it needs to be cached.
That sounds exactly the same as the thing you do when caching a HTTP request to me..?
Whether the fields are in the request body or the query string is pretty much irrelevant.
I think you are just annoyed that they misappropriated HTTP to do it.
- deleted 7y ago[deleted]
- dmitriid 7y ago> That sounds exactly the same as the thing you do when caching a HTTP request to me..? ETag, Is-Modified-Since, Last-Modified, Cache-Control don't require any parsing of the request body. And the relevance is huge. It's one thing to match a resource id in a URL in an idempotent cacheable request. It's another to have request body fully parsed by a caching middleware layer in a non-idempotent non-cacheable request. > I think you are just annoyed that they misappropriated HTTP to do it. They looked at HTTP and threw out everything HTTP already has built in. And all the tools.
- Aeolun 7y ago> It's another to have request body fully parsed by a caching middleware layer in a non-idempotent non-cacheable request. As far as I understand it you can use the request body directly as a caching key. No need to parse it. If you request exactly the same thing there’s no need to re-request it.
- dmitriid 7y agoThat would be a way to do it, but that would require the client to send exact queries. Depending on how queries are constructed, that will not always be the case. Also, a quick look at the top search query for “Apollo graphql caching” shows that Apollo needs to deconsteuct the object (both for the request and the response) to be able to cache things: https://www.apollographql.com/docs/react/advanced/caching/ https://www.apollographql.com/docs/react/advanced/caching/ (I’m using Apollo here as one of the most advanced GraphQL solutions)