Close

Function – Auto clean Autoptimize

 

# Automatically clear autoptimizeCache if it goes beyond 100MB
if (class_exists('autoptimizeCache')) {
    $myMaxSize = 100000; # You may change this value to fit your needs for instance - 100000 for 100MB
    $statArr=autoptimizeCache::stats(); 
    $cacheSize=round($statArr[1]/1024);
     
    if ($cacheSize>$myMaxSize){
       autoptimizeCache::clearall();
       header("Refresh:0");
    }
}