Hi,
I am using the Magento2 REST APIs that don't have any built-in cache, so I have introduced one based on a public module.
Basically what it does is to cache the result of a GET request on products (GET requests for paths that match ^\/V1\/products).
Obviously, details like the stock quantity are not valid anymore if the cache is not invalidated every time someone places an order, but it seems a terrible option.
The only thing I can think of is, based on the website needs, to calculate a good cache TTL (probably X minutes), and accept that the information about stock quantities can be wrong for a short period (X - Y minutes).
Of course a POST request to add a product in the cart will always give the correct output (error if out of stock), but there can be some inconsistency with what is shown.
So, my question is: is this a valid approach?
If the answer is no, can you point me to a good direction?