Hi there, @themassapothecary,
If I got what you’re asking, it sounds like you’re experiencing the preload “cleaning up” after itself to make sure no cached files older than the preload time exist.
If you have preload enabled to run all the time, it forces a cleanup of old files:
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
}
if ( $wp_cache_preload_email_me )
wp_mail( get_option( ‘admin_email’ ), sprintf( __( ‘[%s] Cache Preload Completed’, ‘wp-super-cache’ ), home_url() ), __( “Cleaning up old supercache files.”, ‘wp-super-cache’ ) . “\n” . $msg );
if ( $cache_max_time > 0 ) { // GC is NOT disabled
wp_cache_debug( “wp_cron_preload_cache: clean expired cache files older than $cache_max_time seconds.”, 5 );
wp_cache_phase2_clean_expired( $file_prefix, true ); // force cleanup of old files.
}
(Reading the comments in the code above will help.)
Our developers confirm that what you are trying to avoid somehow is, in fact, the expected behaviour of the plugin. Maybe that’s not what you expect, but if it’s preloading all the time, then you’d want to get fresh cache files.
Hope that helps and makes sense! Please feel free to reach out if you have any other questions or need some more help.
Ok then what do I need to do to preload all page/posts/products/etc, and then disable it unless i manually trigger it so that it doesn’t automatically preload?
It specifically states in docs that when preload is enabled and expert mode for cache (mod rewrite rules used) that garbage collection is disabled.
Yet, it still does this. I set the cache age to over 100 years and it still triggers preloads every 6-12 hours. I want all the pages cached and then them staying cached until I manually trigger the cache to be cleared and a new preload initiated after that. How can I accomplish this?
@erania-pinnera or, how about this. Is there a filter I can hook into to change the frequency at which the preload begins? That way I can add a snippet to the functions.php and make it not happen every 6 hours (or whatever it is) and change to what I want.
Hello @themassapothecary,
I asked our tech team to take a look at your case. Upon checking the plugin code to ensure we’re not missing anything, they suggested trying the following:
- set the option
“Refresh preloaded cache files every 0 minutes” on the preload settings page by entering 0 (zero) in the box before “minutes.
This should help improve the situation. Let us know how it goes!
@erania-pinnera sorry, I thought I said that already. The setting you mentioned is already set to 0 (disabled) and it still deletes cache abd orekisds every several hours.
Hey @themassapothecary,
No worries – apologies if I missed it. I’ll bring this back to our developers, and we’ll get back to you once we hear from them.
We appreciate the patience, and speak soon 🙂
Hi,
Sorry for not getting back to you sooner. The wpsc_delete_files command you’re seeing in the logs only deletes files in a directory. In this case, it’s deleting the homepage after every loop through your posts, which is happening to keep it refreshed. It should not be deleting your entire cache.
I’m not sure why the preload is being restarted 6 to 12 hours later however. Is your server prone to crashing? Are you working on it during preload which might accidentally add temporary PHP fatal errors? There’s a cache counter in the plugin that is usually reset after preload but in some very rare edge cases it might not be. I have an idea for a fix for that, but until we get a new release out, comment out line 3742 in wp-cache.php:
add_action( 'init', 'check_up_on_preloading' ); // sometimes preloading stops working. Kickstart it.
If that fixes the problem of restarting preloads after 6 to 12 hours I will be very interested to hear about it.
EDIT: You can still try commenting out that line, but I’m not sure if it will fix the problem of the restarting preloads. That check_up_on_preloading() function is supposed to restart preloading if it is interrupted for some reason.
It may well be another plugin or other code you have on your server that’s restarting preloading.
Hey @themassapothecary,
Do you have updates about that, do you still need help? We usually close inactive threads after one week of no movement, but we want to make sure we’re all set before marking it as solved. Thanks!