maybe you have inline CSS that is busting the cache, it’s not that common but it does happen.
re. your cron-job;
autoptimizeCache::clearall()
should work 🙂
Hey, so I have been digging around a bit in the code, I want to clear the cache once it reaches a certain size.
Is there a good way to check I think I have it something like this:
$myMaxSize = 256000;
$statArr=autoptimizeCache::stats();
$cacheSize=round($statArr[1]/1024);
if (($cacheSize>$myMaxSize){
autoptimizeCache::clearall()
}
Thanks!
code looks OK allonsacksgmailcom, but don’t kill the canary! 😉
Thanks! I will try it out, looks like I actually got the solution while writing you the question… I actually started writing the question before I had finished and by the time I posted it was kinda I could just test this instead of asking but anyway I appreciate your input and this can help others…
TTLY agree with you about the canary but some clients are small and do not have the budget for me to sort out all the issues to have standardized js and css across the site so emptying the cache every few days is a viable solution. In any case I try to use cache preload and changes in the background require the cache refresh itself every few days.
Are you thinking of adding preload and cache timeout at any point?
Are you thinking of adding preload and cache timeout at any point?
who knows, maybe one day 🙂
Ok so I tested and the following code works by simple dropping it into the functions.php.
This means that instead of using wp-cron and clearing on set days regardless of cache size, the cache this way is cleared when it reaches the size you define.
$myMaxSize = 350000;
$statArr=autoptimizeCache::stats();
$cacheSize=round($statArr[1]/1024);
if (($cacheSize>$myMaxSize)){
autoptimizeCache::clearall();
}