Adjust Cache Size #90

Closed
veslorens opened this Issue Apr 24, 2017 · 9 comments

Comments

Projects
None yet
3 participants

Hello Frank,

I hope you are well and thank you for creating Autoptimize. This is a really helpful plugin.
I am just a beginner in WordPress development. May I ask for your help to provide a sample code on how to adjust the cache size, please?

Your help will be gladly appreciated. Thank you.

Owner

futtta commented Apr 24, 2017

something like this;

add_filter('autoptimize_filter_cachecheck_maxsize','adjust_cachesize');
function adjust_cachesize() {
  return 4*512*1024;
}

where 4 * 512 * 1024 = 2GB

do take into account that this only changes when you get cache size warning, this does not at any point change the size the cache actually uses.

@futtta futtta closed this Apr 24, 2017

Hey Frank,

Great plugin man... thank you!

Where would I apply this code? It looks like Wordpress has removed that little panel that would let you edit plugins... is there a specific file I could just throw this onto the bottom of?

Currently my cache is floating at 1100mb... I hope that's not too much? Very big / very powerful dedicated server... so I'm guessing it can handle it.

Thanks so much for your time and help with this.

veslorens commented Jan 5, 2018

Hi @mrwizard64,

Please try this one:

  1. In your project folder, go to this directory wp-content/mu-plugins/
  2. Create a file custom-autoptimize.php
  3. Insert this code to the file:
<?php
/*
 * Plugin Name: Custom Autoptimize
 * Version: 1.0.0
 * Description: Customize the `Autoptimize` plugin.
 * Author: John Doe
 */

/*
 * Adjust cache size to 2GB.
 */
add_filter( 'autoptimize_filter_cachecheck_maxsize', 'custom_autoptimize_adjust_cachesize' );
function custom_autoptimize_adjust_cachesize()
{
    return 4*512*1024;
}

Basically, this code will run automatically. It will adjust your cache size to 2GB.

Hey thank you for the code! I entered it, and it definitely made an adjustment... unfortunately, it seems as though the adjustment is in the wrong direction. Here's a screenshot:

https://www.dropbox.com/s/8x35xo6ewh5j00p/Screenshot%202018-01-05%2011.43.40.png?dl=0

Then, when I delete the custom php file, my cache limit takes me back into the 'green'. Here's a screenshot after deletion:

https://www.dropbox.com/s/ncsytq6newqfg6n/Screenshot%202018-01-05%2011.45.04.png?dl=0

Thank you for your time and help with this.

Also, if my server can handle it, is it better to have a bigger cache limit?

Owner

futtta commented Jan 5, 2018

unfortunately, it seems as though the adjustment is in the wrong direction.

there were some changes is AO 2.3, so simply increase the number (add a 0 -or two- at the end)? :-)

If my server can handle it, is it better to have a bigger cache limit?

no, cfr. this blogpost.

Hey Frank,

I've decided that this is all way above my pay grade and I'd like to hire you guys for a customized optimization of my site. I filled out the 'interest' form on the backend of the plugin... there's obviously a lot that this thing can do so lets do it.

Owner

futtta commented Jan 5, 2018

what name should I be looking for in the lead-form submissions @mrwizard64 ?

trav@howtofightnow.com I would imagine. It's already a blur.

Owner

futtta commented Jan 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment