Enable caching for WordPress REST API and increase speed of your application
See details on GitHub: http://github.com/airesvsg/wp-rest-api-cache
- Copy the
wp-rest-api-cache
folder into your wp-content/plugins
folder
- Activate the
WP REST API Cache
plugin via the plugin admin page
- Installation Instructions
-
- Copy the
wp-rest-api-cache
folder into your wp-content/plugins
folder
- Activate the
WP REST API Cache
plugin via the plugin admin page
I have a large wordpress site. Many cache calls received.
How to clear cache for the only post which is updated.
This plugin breaks API response by messing up returned JSON and increases its size (eg.: 100KB -> 5MB).
This plugin appears to cache REST API responses based on their handlers, not on their request. When a handler is written in the form of an anonymous function, it doesn’t work, producing a fatal error. Truly, except with the help of a couple of PHP libraries, serialization of closures is not possible in PHP at all. Endpoint authors cannot be expected to use named functions (bleh!) just because of this limitation.
Another major problem is that the plugin apparently uses WP transients to cache the response body. No other caching medium can be used. Not sure why I would cache a 1MB JSON response in a transient in the DB – a file seems to be a much better way for that.
Finally… why re-invent the wheel? Use PSR-16.
It seems about 8 times faster to make API calls now using this plugin. 5 Stars all the way!
Remember to set WP_DEBUG to false in wp-config or will not work.
there is a bug and the owner is not interested in
إقرأ جميع المراجعات 7
“WP REST API Cache” هو برنامج مفتوح المصدر. وقد ساهم هؤلاء الأشخاص بالأسفل في هذه الإضافة.
المساهمون
1.2.0
adding rest_cache_headers filter
1.1.0
improving the arguments of filters
1.0.0
initial version