WP Super Cache
Cache clearing and shouldn't? (12 posts)

  1. Kevin
    Posted 4 years ago #

    I am running with cache timeout set to "0" and ALSO in preload mode, but periodically my cache clears out. This happens every day or so.
    Does anyone have any idea why this may be happening?


  2. James Revillini
    Posted 4 years ago #

    Do you happen to have 'Clear all cache files when a post or page is published or updated.' checked in advanced settings?

  3. Kevin
    Posted 4 years ago #

    I do not have that checked

  4. James Revillini
    Posted 4 years ago #

    What's it say under the Contents tab under garbage collection? Should look something like

    Garbage Collection
    Last GC was 55:17 minutes ago
    Next GC in 14:43 minutes

  5. Kevin
    Posted 4 years ago #

    It used to say that, but since i have set the expiration to 0 that message has dissapeared.
    I am running debug to catch when the cache does clear again

  6. James Revillini
    Posted 4 years ago #

    Hm. I just found this in the preload scheduler function

    if ( $wp_cache_preload_interval > 0 ) {
    	$cache_max_time = (int)$wp_cache_preload_interval * 60; // fool the GC into expiring really old files
    } else {
    	$cache_max_time = 86400; // fool the GC into expiring really old files

    Looks to me like this overrides the cache timeout setting and then it runs the thing to get rid of expired files. It does this LAST in the function, so if you happen to check the cache after a big cleanout but before the next preload, I see why it would be empty. I could be reading the code wrong, but it seems like an order of operations issue.

  7. Kevin
    Posted 4 years ago #

    Interesting, I do have preload activated but the interval set to 0.

    so would that else statement kick off the GC every 86400 despite having GC disabled?

  8. James Revillini
    Posted 4 years ago #

    I think you said you had Cache Timeout set to 0 (disable GC) but Preload Mode on, so you must have some value higher than 0 for Preload Interval, no?

    If so, then yes, the preload function kicks off every {preload interval} seconds. IF I'm reading the code right, the last thing it does is set a fake cache_max_time (Cache Timeout) of 86400 and then runs GC anyway :)

    I'm not going to try to fix this one because for all I know, maybe you HAVE TO kill old files if preload is ever going to run and it could take tons of refactoring to get it to work as expected.

  9. James Revillini
    Posted 4 years ago #

    side note: i'm off for the day. Talk tomorrow. Good bug reports!

  10. Kevin
    Posted 4 years ago #

    I actually DO have the interval set to 0. I put it into preload to see if that would stop the cache from getting dumped via GC, but set the interval to 0 to disable the auto preload. This way i can hit 'preload now' if i want to and otherwise just leave it alone.

    One reason I've done this is the preload is not working correctly either which i have another post that never got any attention...

  11. James Revillini
    Posted 4 years ago #

    OK, I'm getting the full picture now. So cache timeout is 0. Preload interval is 0. Everything is quiet. You hit Preload cache now. Thing builds your cache, then sets a cache timeout of 86400 and cleans out old files. But no files should be old bc they are refreshed in batches by wp cron. Even if the 86400 rule nukes everything, preload does like 100 posts at 30 second intervals, so it should rebuild right after.

    Damn. I am stumped. :/ Best thing I can tell you is to keep debugging enabled and monitor for 'Cleaning expired cache files' and 'wp_cron_preload_cache'. Also, switch on emails for preload. That should give you a beat on the issue if it starts running without your involvement. Sorry I couldn't be more helpful.

  12. Donncha O Caoimh
    Plugin Author

    Posted 4 years ago #

    Kevin - can you enable the debugger in the plugin and watch it when your site preloads? Even though you have garbage collection disabled the preload function has to clear out really old cache files. In this case it's cache files older than a day.

    It shouldn't clear out newly preloaded pages though.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Super Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic