• Resolved ahnabil

    (@ahnabil)


    i don’t want to kill the canary, and i don’t aggregate inline JS, but in the end of the day my cache gets full and i need to flush that when it gets full

    i’ve tried that but isn’t working, i need the snippet along side WP Super Cache

    /*——————————-*/
    /* # Automatically clear autoptimizeCache if it goes beyond 256MB
    /*——————————-*/

    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();

    // Clear all W3 Total Cache
    if( class_exists(‘W3_Plugin_TotalCacheAdmin’) )
    {
    $plugin_totalcacheadmin = & w3_instance(‘W3_Plugin_TotalCacheAdmin’);
    $plugin_totalcacheadmin->flush_all();
    # echo __(‘<div class=”updated”><p>All W3 Total Cache caches successfully emptied.</p></div>’);
    }

    header(“Refresh:0”); # Refresh the page so that autoptimize can create new cache files and it does break the page after clearall.

    }

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    I don’t know @ahnabil, but maybe ask the guy who wrote that snippet or the developer of this plugin?

    Thread Starter ahnabil

    (@ahnabil)

    *——————————-*/
    /* # Automatically clear autoptimizeCache if it goes beyond 256MB
    /*——————————-*/
    
    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();

    that snippet clear cache if got full? got it never worked, is that the right snippet?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, there are 2 closing brackets missing at the end to close the 2 if-blocks.

    and then there’s the question of where you add that code and how you trigger it?

    Thread Starter ahnabil

    (@ahnabil)

    great i was just going to ask the 2 questions, but for where i’ll throw it in functions.php, but how do i trigger it?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, the guy who wrote it says it has to be added to functions.php B-)

    Thread Starter ahnabil

    (@ahnabil)

    yeah thats awesome progress, now we have the snippet and where to put it.
    the last question remains, how should we trigger it? ??

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, I guess (but the original author should confirm) it is executed with every request to wordpress (if the theme is called).

    might be better to hook it into a wordpress action if you ask me, but who am I ??

    Thread Starter ahnabil

    (@ahnabil)

    who are you mate ? ??

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ask my wife, she knows it all ??

    Thread Starter ahnabil

    (@ahnabil)

    no mate, can’t she’s yours only, can you please ask her for me what is the right snippet so that life can goes on? without killing the damn canary

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ??

    OK, if you have some wordpress development experience, then put above code in a function of your own and use add_action to hook your function into the shutdown action.

    If you’re not into development, I suggest you look into this plugin instead?

    regarding the canary; if you just keep on purging the cache automatically to keep the size from growing too large, you are effectively killing (or at least muting) the canary, cfr. this blogpost.

    Thread Starter ahnabil

    (@ahnabil)

    Thanks mate, and thank your wife for me. ??

    if that’s just muting the canary, how can i track down the real issue?

    if i set the cache size to 10GB it gets filled anyway

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    how can i track down the real issue?

    my daughter suggests to disable the “also aggregate inline JS” (and possibly also the CSS one) option and she says there’s more info in the FAQ B-)

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Autp purge cache’ is closed to new replies.