• Resolved piotrmerton

    (@piotrmerton)


    Hello, I am a little bit puzzled about Expired Cache not getting regenerated. I have set “Cache timeout” to 6 hours, checked “Enable cache regeneration” and set “Regeneration Interval” to “Twice a day”, but expired endpoints are not getting regenerated at all – in fact, they are marked as Active? Can you explain what “Active” flag means?

    I registered custom endpoint to be cached via wp_rest_cache/allowed_endpoints hook. They are not related with any Object Type because they serve data from external service.

    For example:

    I have an endpoint /wp-json/theme/v1/playerstats?id_player=504 with Expiration 2022-03-29 16:31:49 and 9 Cache hits. Shouldn’t it update its Expiration date on load when directly accessed/requested? For now it only increases “Cache hits” but Expiration date stays the same (which is more than 7 days past Cache Timeout). Is this intended behaviour and only way to update Expiration date is to manually flush cache?

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

    (@rockfire)

    Hi @piotrmerton

    Sorry for the extremely late reply.

    Can you explain what “Active” flag means?

    The active flag means there is an active cache record. So there is a transient cache recordfor this specific request. So if you would request it now, it would be served from cache.

    Shouldn’t it update its Expiration date on load when directly accessed/requested?

    It should update the expiration date when at the beginning of the call there wasn’t any active cache record and a new cache record has been generated.

    Is this intended behaviour and only way to update Expiration date is to manually flush cache?

    No it isn’t intended behaviour. As a matter of fact either the cache should have expired automatically and the active flag should state it is no longer active, or the expiration date should have been updated with the new date. Somehow in your installation something has gone wrong, because an active record with an expiration date in the past should not be possible. I am however unable to reproduce it, so it is a little hard for me to debug at this time. But I will keep an eye out for this problem to see if I can find the cause (and a solution).
    For now could you try and delete the cache record (delete, not flush) and see if the problem will reappear? Just to check if it is reproducable on your installation.

    Thread Starter piotrmerton

    (@piotrmerton)

    Thank you for your reply and thorough explanation.

    For now could you try and delete the cache record (delete, not flush) and see if the problem will reappear? Just to check if it is reproducable on your installation.

    After deleting records the problem still persisted and expired cache weren’t regenerated. It happened to all custom endpoints added to wp_rest_cache/allowed_endpoints hook. On both production and dev environment. I ended up disabling plugin for the time being.

    If you are interested I can provide code to theme via private message, though I pretty much copied example from your “Can I register my own endpoint for caching?” FAQ question.

    Thread Starter piotrmerton

    (@piotrmerton)

    Hey @rockfire here’s the followup. I investigated a little bit further why the expired records still have “Active” flag and I narrowed it down to either 1) specific server configuration or 2) Redis Object Cache – because on localhost it works as intended, so it looks like issue is not with WP Rest Cache plugin itself.

    • This reply was modified 2 years, 4 months ago by piotrmerton.
    Plugin Author Richard Korthuis

    (@rockfire)

    Hi @piotrmerton

    Thank you for your follow up. I am sorry to hear the problem has not yet been solved, but am happy to hear it is not a problem with our plugin. Please let us know if there is anything we can do to help resolve the issue.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Expired Cache is not getting regenerated’ is closed to new replies.