Replies: 3 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
Maybe a better REST API cache system is needed. One that is suited for CoCart and WooCommerce. |
Beta Was this translation helpful? Give feedback.
-
So last week I experimented on building my own cache for the REST API that saves the response as a JSON file with the request hashed by MD5 and loads that JSON file if one exists. Only GET requests of course. No database, no transients required. There are plenty of filters for developers to change things how they wish from the headers, length of the cache and which API's to cache. I also make sure what API's to ignore should they cause issues like WC Report API does. At the moment it's just a prototype but I will have CORS built in and support for WooCommerce out of the box including the ability to clear the cache when products are updated. I've only tested locally but I'm sure once I have more time to work on it, it should be the fastest and supported REST API cache out there. |
Beta Was this translation helpful? Give feedback.
-
In version 2.1.2 of CoCart I prevented the "WP REST API Cache" plugin from caching any route requested via CoCart.
A lot has changed since that release and I am now looking at improving performance now that the products API is part of the core.
I have only had a few requests on this so it hasn't been a high priority but it's also a double edge sword.
If caching was enabled, at what point does the API request get updated? How long is it cached for? How is it cached?
While it's not something I want to completly say no too, it is something that needs to be discussed.
Obviously having a decent web host is the best option if your using a REST API to make requests and shouldn't be any higher than 600ms for a decent shared host.
But the size and time of each requests vary especially when it comes to the customers shopping cart so when I hear that a request took over a 1000ms it looks bad on my end even though it's not my fault. Just the way it is.
But I don't want it to be so I would like to hear your thoughts and any ideas you can come up with to improving the performance.
Beta Was this translation helpful? Give feedback.
All reactions