2

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)?

1 Answer 1

3

This can help you:

https://github.com/magespecialist/m2-MSP_APIBoost

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

3
  • We installed this module and now I am facing error when I try to add one line of code in .vcl file Commented Aug 8 at 5:57
  • Syntax error: Expected an action, if, { or } at: (input Line 930 Pos 8) hash_data(regsub(std.tolower(req.http.Authorization), "^bearer\s\x22(\w+?):\w+?\x22", "\1")); -------#########------------------------------------------------------------------------------------ Commented Aug 8 at 5:57
  • any idea on this? Commented Aug 8 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.