• Resolved jacobraccuia

    (@jacobraccuia)


    Hi, I have been posting a lot here as I’m trying to get the most from this incredible plugin.

    I noticed that regeneration wasn’t working the way I expected. I thought that any flushed / deleted cache would regenerate, but it seems that it is coded to only regenerate caches that have expired.

    Steps to produce:
    1. Save a cache (/wp-json/wp/v2/posts/)
    2. Modify a post to flush that cache (or manually flush it)
    3. Check table (cache is flushed)
    4. Run cron job to regenerate cache
    5. Check table – cache is still flushed.

    Are flushed caches intentionally not regenerated?
    The following line in the regenerate_expired_caches method is stopping the cache regeneration from firing in class-caching.php

    if ( false === get_transient( $this->transient_key( $result['cache_key'] ) ) ) {

    It doesn’t check the date to see if the date has expired.

    Thanks!

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

    (@rockfire)

    Hi @jacobraccuia

    No flushed caches aren’t intentionally not regenerated, you just found a bug ?? So thank you for your debugging!

    You can easily solve it by changing that line of code to:
    if ( 1 === strtotime( $result['expiration'] ) || false === get_transient( $this->transient_key( $result['cache_key'] ) ) ) {

    We will release a new version of our plugin soon with this bugfix in it.

    Thread Starter jacobraccuia

    (@jacobraccuia)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cache regeneration – expired vs flushed’ is closed to new replies.