BenjaminAdams / wp-redis-cache

Cache Wordpress faster
157 stars 39 forks source link

Caching WP-API ? #38

Open EugeneLiang opened 8 years ago

EugeneLiang commented 8 years ago

Hi good day,

I was wondering if this plugin caches WP-API endpoints ?

Cheers and Merry Christmas!

BenjaminAdams commented 8 years ago

Not sure, but if I had to guess it would. It would be simple to install and test :) On Dec 19, 2015 12:39 AM, "Eugene Liang" notifications@github.com wrote:

Hi good day,

I was wondering if this plugin caches WP-API endpoints ?

Cheers and Merry Christmas!

— Reply to this email directly or view it on GitHub https://github.com/BenjaminAdams/wp-redis-cache/issues/38.

EugeneLiang commented 8 years ago

Hi, i've tested it and it seems to crash WP-API.

The error is:

Warning: Cannot modify header information - headers already sent by (output started at /dev/learn_php/wordpress/index-wp-redis.php:74) in /dev/learn_php/wordpress/wp-includes/rest-api.php on line 340

Warning: Cannot modify header information - headers already sent by (output started at /dev/learn_php/wordpress/index-wp-redis.php:74) in 
/dev/learn_php/wordpress/wp-includes/rest-api.php on line 340

Warning: Cannot modify header information - headers already sent by (output started at /dev/learn_php/wordpress/index-wp-redis.php:74) in 
/dev/learn_php/wordpress/wp-includes/rest-api.php on line 340

Warning: Cannot modify header information - headers already sent by (output started at /dev/learn_php/wordpress/index-wp-redis.php:74) in 
/dev/learn_php/wordpress/wp-includes/rest-api/class-wp-rest-server.php on line 1149

Warning: Cannot modify header information - headers already sent by (output started at /dev/learn_php/wordpress/index-wp-redis.php:74) in /dev/learn_php/wordpress/wp-includes/rest-api/class-wp-rest-server.php on line 1149

{"id":1712,"date":"2015-11-15T13:11:06","date_gmt":"2015-11-15T13:11:06","guid":{"rendered":"http:\/\/localhost:8000\/this-is-a-new-post-title-3\/"},"modified":"2015-12-09T13:40:24","modified_gmt":"2015-12-09T13:40:24","slug":"this-is-a-new-post-title-3","type":"post","link":"http:\/\/127.0.0.1:8000\/this-is-a-new-post-title-3\/","title":{"rendered":"this is a new post title 3"},"content":{"rendered":"
this is the new post content 3<\/p>\n"},"excerpt":{"rendered":"

this is the new post content 3<\/p>\n"},"author":1,"featured_image":0,"comment_status":"open","ping_status":"open","sticky":false,"format":"standard","acf":{"extra_post_field_1":"Extra Post Field 1 default value","extra_post_field_2":"Extra Post Field 2 default value"},"_links":{"self":[{"href":"http:\/\/127.0.0.1:8000\/wp-json\/wp\/v2\/posts\/1712"}],"collection":[{"href":"http:\/\/127.0.0.1:8000\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/127.0.0.1:8000\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/127.0.0.1:8000\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/127.0.0.1:8000\/wp-json\/wp\/v2\/comments?post=1712"}],"version-history":[{"href":"http:\/\/127.0.0.1:8000\/wp-json\/wp\/v2\/posts\/1712\/revisions"}],"https:\/\/api.w.org\/attachment":[{"href":"http:\/\/127.0.0.1:8000\/wp-json\/wp\/v2\/media?parent=1712"}],"https:\/\/api.w.org\/term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/127.0.0.1:8000\/wp-json\/wp\/v2\/posts\/1712\/categories"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/127.0.0.1:8000\/wp-json\/wp\/v2\/posts\/1712\/tags"},{"taxonomy":"post_format","embeddable":true,"href":"http:\/\/127.0.0.1:8000\/wp-json\/wp\/v2\/posts\/1712\/post_format"}],"https:\/\/api.w.org\/meta":[{"embeddable":true,"href":"http:\/\/127.0.0.1:8000\/wp-json\/wp\/v2\/posts\/1712\/meta"}]}}
lfbn commented 8 years ago

Do you want to cache those requests? If not, maybe you can use a different "index.php" to use the WordPress API...