With this setup I thought the categories part of my query would get cached for one day, but that the product part would never be cached. What I’m seeing though is that the whole query is cached for a full day. Is this the expected behavior? If so, how can I make it work like I thought it would?
And going by the comment there is seems like as long as a query contains one of the configured query names the full query will be cached. So, in my case, because my query contains categories the whole thing is cached for a day. Which is a bit of a bummer, because individual products are much more likely to be updated (price change etc) than a full category is added/edited/removed.
So I guess this is the expected behavior. Question still remains though how to work around it.
Force-disabling cache for product seems to stop caching. I’m afraid though that with that I also disable caching of the categories part of the query. But I don’t know.
The thing is, remember this is a “Response” cache – it caches the entire document that is returned.
So, if the response has category and product data in it – and one item in that large document changes – then that entire document is purged/invalidated when any product or any category in that doc changes.
Keep in mind that what is caches is the data response.
The rules state for how long to cache and what to invalidate.
Because you have two models’ data in the same response if the shorter of the two gets an invalidate then the entire cached response is purged — there is no partial response invalidation.