Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support WP-API #19

Open
hochitom opened this issue Oct 23, 2015 · 5 comments
Open

Support WP-API #19

hochitom opened this issue Oct 23, 2015 · 5 comments

Comments

@hochitom
Copy link

In fact that wp-api is being merged into wordpress core soon, you should add support for caching wp-api requests as soon as possible.

@swissspidy
Copy link
Contributor

Thanks for this issue!

First and foremost, only the REST API infrastructure is being merged into WordPress 4.4. Endpoints are probably coming with 4.5 because they still need need some work. That means we don't need to hurry.

Second, caching REST API requests is not as easy as it seems. There are lots of edge cases that need to be considered.

I'm definitely keeping an eye on this to see how Cachify will fit into the whole picture.

@te-online
Copy link
Contributor

Another thing could be doing it the other way round: I have a node.js app using WP-API and caching the data by itself. I would love to have a unified action from Cachify that would fire each time the cache gets refreshed so that I could trigger a url in the node.js app that would also refresh the cache of the app from the API. Is there a possibility to do this?

Could be a nice feature, because caching is not restricted to WordPress (where it's quite hard), but can be easily implemented in systems that use the API – the only thing that remains is the missing trigger when something is updated in WordPress.

@swissspidy
Copy link
Contributor

If there isn't already an action for that, we can definitely add one that is being run when the cache gets refreshed. Adding a custom endpoint for that sounds like something other developers should do themselves.

@te-online
Copy link
Contributor

This actions looks like what I was looking for:
https://github.com/pluginkollektiv/cachify/blob/master/inc/cachify.class.php#L106
Will give it a try.

@derweili
Copy link

In the meantime, the REST-API has been in core for about 3 years now.
Is supporting the REST-API still a desired feature?

It's quite simple to support the API by just hooking into the parse_request action. (needs further checks)

add_action(
    'parse_request',
    'Cachify::manage_cache',
    0
);

Althought is looks so simple it does not make sense to me.

Because Cachify does not support caching for Requests including GET Parameters we can only cache the basic endpoints without any query parameter. Even pagination works via a GET Parameter so we can only cache the first page of every request.

When ever I used the WordPress REST-API, I used at least one GET parameter.
So I would never have had the benefit of caching functionality.

For me caching the REST-API without supporting GET Parameters makes no sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants