Forum Replies Created

Viewing 15 replies - 31 through 45 (of 99 total)
  • Plugin Author Acato

    (@acato)

    Hi @redcastor

    Our latest releases of the plugin now solves this issue.

    Plugin Author Acato

    (@acato)

    Hi @redcastor

    We have decided to do it slightly different than your implementation, but you are now able to specify request headers for caching. See the new FAQ entry for more details.

    Plugin Author Acato

    (@acato)

    Hi @redcastor

    We just released a new version of our plugin. For several reasons and the fact that the Item API Cache wasn’t adding a real performance boost, we have decided to remove it completely. So I would say that also solves your problem, right?

    Plugin Author Acato

    (@acato)

    Hi @antonemery

    Thank you for using our plugin!

    As you say so yourself, it is working on your local test blog. There is no reason why it would not work on your dev production blog. Are you sure you filled out the correct settings in Yoast?

    Plugin Author Acato

    (@acato)

    Hi,

    Hmm too bad, because that would be the easy explanation πŸ˜›

    Just to be sure some questions:

    • Are you doing a GET-request? Only GET-requests get cached.
    • Can you check your database in the wp_options table for the values where option_name = wp_rest_cache_rest_prefix and wp_rest_cache_allowed_endpoints? If either one of these is empty (or not filled correctly) it will cause caching to be skipped.

    If none of the answers to these questions provide some insight into why the call isn’t cached, please try and disable the plugin and do a call to the REST API. Check what HTTP Status code you get back from the API, if it isn’t 200 than that is why it isn’t cached.

    Plugin Author Acato

    (@acato)

    Hi @mighty_mt

    This might occur when the setup of the plugin was unable to copy its Must Use plugin to the correct directory. To fix this you can copy it manually from /wp-content/plugins/wp-rest-cache/sources/wp-rest-cache.php to /wp-content/mu-plugins/wp-rest-cache.php

    Plugin Author Acato

    (@acato)

    Hi @mighty_mt

    Thank you for using our plugin!

    The kind of (JSON-)data in the endpoint doesn’t matter for the WP REST Cache plugin. However, the plugin will not always be able to determine the type of data and cache it as type ‘unknown’. You can help the plugin to determine the data type by using the wp_rest_cache/determine_object_type filter. At this point it doesn’t matter that much that the plugin cannot determine the data type. But in a future release we will add code to flush the data type ‘unknown’ very frequently, because it can cause some errors.

    But back to your issue: I have tested your dummy plugin on a clean WordPress installation with only your plugin and the WP REST Cache plugin activated. And the endpoint is cached correctly. So either you are doing something slihtly different than in your dummy plugin or some other plugin is causing some problems.

    Please let me know if we can be of any more assistance!

    Plugin Author Acato

    (@acato)

    Hi @holaeffect

    It is still a work in progress and we are brainstorming how it should actually work / where you can do the settings exactly), but the general idea is this:

    In the settings of the plugin you can set which request headers should be used (or possibly via a hook so you can set it per endpoint).

    So if for instance you are sending a header WPLANG (to set which language should be returned), you then set it as cacheable header. And each time you do a request to the WP REST API, the caching plugin will check if there is already a cache record for the requested url combined with the correct WPLANG header.
    So a call to /wp-json/wp/v2/posts with request header WPLANG set to en_US will result in a different cache than a call to the same url /wp-json/wp/v2/posts but with the request header WPLANG set to nl_NL.

    What you want could be quite hard (maybe even impossible) to implement correctly. You want specific items not to be cached. But what if that item is one of the items returned by the /wp-json/wp/v2/posts endpoint? That would mean we cannot cache that endpoint at all?
    I am going to think about it a bit more, to see if maybe we can come up with a workable solution for this.

    Plugin Author Acato

    (@acato)

    Hi @holaeffect

    Thank you for using our plugin!

    We are working on a new feature where you can have certain request headers be used to distinguish between seperate caches, maybe that can help?

    Until that feature is released there are some possible fixes:

    I know these aren’t really nice solutions, so please let me know if the feature I described (about using request headers to distinguish between seperate caches) can help you. Because if it cannot help you maybe we can think of a different solution we could implement.

    Plugin Author Acato

    (@acato)

    Hi @davidrouyer

    Thank you for letting us know you solved it! And please let us know if we can be of any more assistance.

    Plugin Author Acato

    (@acato)

    Hi @davidrouyer

    Well that aren’t much plugins, so little change any of the other plugins is causing this. I will try and debug it myself too, but unfortunately that will be somewhere next week. So please let me know if you find something, so we can see if we can deploy a fix for it πŸ™‚

    Plugin Author Acato

    (@acato)

    Hi @davidrouyer

    Sorry to ask, but if it breaks randomly how can you be sure it is because of the plugin?

    I have searched through the WordPress core, specifically the part where the _embed parameter is processed. But unfortunately I can not find any clue as to why our plugin would break this functionality. As a matter of fact I have tried to reproduce it on my local test-environment, but whatever I do (with or without the plugin activated) it simply always works. Especially the randomness of the issue, makes it really hard for me to explain.
    I would like to help you debug this issue, but at this point I really need more information: what plugins do you have installed (and which are activated)? What theme? How do you make the call to the REST API? Are you sending any extra headers?

    Plugin Author Acato

    (@acato)

    Hi @davidrouyer

    It appears that your setup doesn’t always correctly include the _embedded. If I take your example: https://staging.wp.hopfab.com/wp-json/wp/v2/projects?slug=agencement-surmesure-bureaux-alter-solution&_embed and add &skip_cache=1 to (that will force it to NOT use cache) I also don’t see the _embedded. So if it isn’t generated it can not be cached πŸ™‚

    As I said, the plugin isn’t doing anything to prevent the _embed parameter to work. As a matter of fact the very simple explanation of how it does the caching is:
    Is there a cache available?
    – Yes? > Return cache
    – No? > Let WordPress process the request as it would normally do (including handling all query parameters) and cache the result.
    So the first time the cache is created it is all handled by WordPress, the plugin doesn’t do anything to the results of the call.

    Plugin Author Acato

    (@acato)

    Hi @davidrouyer

    Thank you for using our plugin!

    The plugin is doing nothing to prevent the _embed query parameter from working. As a matter of fact, we ourselves are using this query parameter quite a lot in combination with our plugin. I just tested it on one of our headless sites and it is working correctly and also being cached correctly.
    I visited the urls you provided, but it appears you no longer have the plugin activated, since I don’t see the X-WP-Cached-Call response header.

    Plugin Author Acato

    (@acato)

    Hi @neufeld

    Clear, the title you can set there is the same as the og:title. On a non-headless website Yoast SEO also manipulates the <title>-tag to change it to that title. We have however not yet implemented it to also change the title in the default REST API response, since at first we only wanted to add the actual <meta>-tags. I will add it to a list of possible improvements for the future. For now you could use the og:title since it is exactly the same value.

Viewing 15 replies - 31 through 45 (of 99 total)