mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-02 12:02:25 +08:00
https://wordpress.org/support/topic/contribution-autoptimize-cache-size-under-control-by-schedule-auto-cache-purge/
10 lines
458 B
Text
10 lines
458 B
Text
if (class_exists('autoptimizeCache')) {
|
|
$myMaxSize = 256000; # You may change this value to lower like 100000 for 100MB if you have limited server space
|
|
$statArr=autoptimizeCache::stats();
|
|
$cacheSize=round($statArr[1]/1024);
|
|
|
|
if ($cacheSize>$myMaxSize){
|
|
autoptimizeCache::clearall();
|
|
header("Refresh:0"); # Refresh the page so that autoptimize can create new cache files and it does breaks the page after clearall.
|
|
}
|
|
}
|