I'm using Magento 2 as something of "commerce engine" for a project I'm working on, which means extending and accessing a lot of Magento's functionality via REST API.

To speed things up I intend to add a caching layer in front of the API to at least optimize some of the "low hanging fruit" responses. A primary (and perhaps sole use at launch) example of this would be product information. I would ideally like to cache this data so that any GET requests for product data is cached (this data may be requested a LOT by the frontend, so I don't want to have to hit Magento with every request!).

My question comes around cache invalidation. I'm new to Magento 2 (but long time Magento 1 developer) and am wondering if there are any sorts of mechanisms built in for cache invalidation for this type of request. I've heard that Magento 2 is supposed to be "better" when it comes to the REST API, and I've also heard that in general Magento 2 is "made" to have a cache sitting in front (aka Varnish, which is what I'm guessing we'll be using at this point).

What I'm wondering is how much of the invalidation of cache might be handled on the REST API level "out of the box", or if this is something we'll have to write ourselves (i.e. listening to specific events and sending ban requests to Varnish myself)?


This can help you:


it is a small configurable caching system for Magento 2 REST API calls. Is very simple and flexible.

Your Answer

