Created
January 19, 2018 14:06
-
-
Save taylorbryant/f47989870d55c90f8f42cdbbd0bb91c6 to your computer and use it in GitHub Desktop.
Clear Autoptimize & W3 Total Cache when 64 MB limit is hit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Clear Cache (64 MB Limit) | |
if ( class_exists('autoptimizeCache') ) { | |
$myMaxSize = 48000; | |
$statArr = autoptimizeCache::stats(); | |
$cacheSize = round( $statArr[1] / 1024 ); | |
if ($cacheSize > $myMaxSize ) { | |
autoptimizeCache::clearall(); | |
if ( class_exists('W3_Plugin_TotalCacheAdmin') ) | |
{ | |
$plugin_totalcacheadmin = & w3_instance('W3_Plugin_TotalCacheAdmin'); | |
$plugin_totalcacheadmin->flush_all(); | |
} | |
header("Refresh:0"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment