• Resolved Limegrow

    (@limegrow)


    Hi!

    We’re facing a following challenge where some caches are immediately marked as expired after creation. Yet one is not.

    Here’s an example of requests that are being made with one page load: https://imgur.com/1dv6dxP
    Here’s how it looks in the admin: https://imgur.com/xrUY3qY

    Any ideas on how to debug/pinpoint the issue, are welcome. We’re comfortable with code and can add breakpoints/debug output to wherever you recommend. ๐Ÿ™‚

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Richard Korthuis

    (@rockfire)

    Hi @limegrow

    Thank you for using our plugin!

    I would start with the set_cache(...) function in includes/caching/class-caching.php. Somehow the transient isn’t set (correctly).

    Thread Starter Limegrow

    (@limegrow)

    Thanks! We’ll dig in. ๐Ÿ™‚

    Thread Starter Limegrow

    (@limegrow)

    Hi again!

    What I’ve noticed now is that the headers are different between local development and live server. Live server does not cache, local caches.
    Are you able to tell if there are any red flags between the response Headers that could cause that? If not, then we’ll dig deeper.

    Left = Local = Cache works
    Right = Live = Cache does not work

    View post on imgur.com

    Thread Starter Limegrow

    (@limegrow)

    @rockfire

    Update here: Does not seem like Headers have anything to do with it.
    When doing Posts requests up to 30 per_page, it works. Going higher starts to cause the expired issue.
    Examples that still cache:

    • /wp-json/wp/v2/posts?per_page=1
    • /wp-json/wp/v2/posts?per_page=10
    • /wp-json/wp/v2/posts?per_page=30

    But this gets immediately expired:

    • /wp-json/wp/v2/posts?per_page=40
    Thread Starter Limegrow

    (@limegrow)

    Update:
    Nailed it down to specific posts that are in the output. With ?per_page less than 40 it just happened that the specific post did not appear in the JSON output and thus all was good.
    Currently it seems that we have a post with ID 91, and when this post is asked individually (/wp-json/wp/v2/posts/91), it also gets expired immediately.
    No errors are shown regarding that post so still no clue why (debug mode is on) it gets expired.

    Plugin Author Richard Korthuis

    (@rockfire)

    @limegrow Wow, you did some real digging!

    Is there any chance you could send me the response of the individual call (/wp-json/wp/v2/posts/91)? Either here or via email plugins <at> acato <dot> nl

    I want to see if there is something in the response that might be causing this.

    Thread Starter Limegrow

    (@limegrow)

    @rockfire that was just the beginning. ๐Ÿ™‚

    I’ll send you an email soon.

    I’m having the same issue with one of my company product blogs but I am no WP expert to assist debugging. I’m following closely this thread and looking towards your findings and solution.

    Plugin Author Richard Korthuis

    (@rockfire)

    Hi @thanhttran

    Thank you for using our plugin!

    Via email we have had some contact with @limegrow and the cause of his problem was found in the collation of his database tables / columns. This caused WordPress to be unable to save records (transients) with certain characters in it (in this specific case: ๐Ÿ™‚ ). Unfortunately this is an issue with the database / WordPress and not something we can solve.

    Having said that, I have no way of knowing if your issue is the same. But if you are using any special characters try removing them to test if that solves the issue. If it doesn’t help could you please send me the JSON response from the WP REST API for that specific product blog? Either here or via plugins <at> acato <dot> nl. Maybe I can find what is causing your issue.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Caches expired immediately after creation’ is closed to new replies.