Auto clean cache Autooptimize

0.0/5
<?php
function ao_clean_cache() {
if (class_exists('autoptimizeCache')) {
$myMaxSize = 400000; # You may change this value to lower like 500000 for 500MB if you have limited server space
$statArr=autoptimizeCache::stats();
$cacheSize=round($statArr[1]/1024);

if ($cacheSize>$myMaxSize){
autoptimizeCache::clearall();
}
}
}
add_action( 'init', 'ao_clean_cache' );

Comments and reviews

{{ reviewsTotal }} Review
{{ reviewsTotal }} Reviews
{{ options.labels.newReviewButton }}
{{ userData.canReview.message }}

Description

This snippet was fetched automatically from WPDistro.cz projects.

Author

Tags

This snippet is untagged