Viewing 14 replies - 1 through 14 (of 14 total)
  • Having the same issue with php and php.none files in the cache/autoptimize folder.

    Thread Starter gab81

    (@gab81)

    i do not have those files in cache/autoptimize

    Plugin Author Frank Goossens

    (@futtta)

    On holiday now, but have a look at the FAQ, it has some great info on this topic.

    Thread Starter gab81

    (@gab81)

    Btw Frank when you r back from holidays if you can share the 410 process for https://www.ads-software.com/support/topic/some-404s that willbe great ??

    Plugin Author Frank Goossens

    (@futtta)

    Some feedback:
    1. huge cache size typically is due to page- or request-specific JS (or CSS) which you should either exclude (see FAQ), or you could tell AO not to aggregate internal JS (or CSS) (see autoptimize_helper.php_example)
    2. the .php-files (instead of .css/.js) is because you configured AO to deliver the CSS/JS dynamically, but the same principle from (1) applies.
    3. 410: check ??

    frank

    Thread Starter gab81

    (@gab81)

    btw in the .htaccess I noticed that we have

    Header set Cache-Control "max-age=10672000, must-revalidate"

    if that means a AO creates a new file every 3 hours (if that’s milliseconds), if I increase the size of that file, wouldn’t create less often new cached files?

    I noticed my cached files in the cache/autoptimize/js seem to be created at more or less 3 hours intervals….

    thanks
    Gab

    Plugin Author Frank Goossens

    (@futtta)

    nah, those are seconds and this is used by browsers (or proxies) to determine how long they can cache the autoptimized CSS/ JS.

    frank

    Thread Starter gab81

    (@gab81)

    thanks Frank – I am still thinking what’s best solution for the growing js files in that folder. seems I get around 6mb in new .js every day or so.

    I did take 2 blog posts and compared their js files as you suggest at https://blog.futtta.be/2014/03/19/how-to-keep-autoptimizes-cache-size-under-control-and-improve-visitor-experience/ but could not find any difference, they were exactly the same.

    I am thinking that one of the plugins might change “something” so that a new .js file needs to be written. since I didn’t add any posts in a specific time period, it’s a bit odd. perhaps something in my theme though. as I was saying I get a new .js every 3 hours approx.

    Gab

    Plugin Author Frank Goossens

    (@futtta)

    the name of the file is autoptimize_<md5($content)>.js (or .css). this implies that if the content is identical (to the comma), the name is the same and the cached file can be used. a file with a different name has a different hash meaning it must have something (a space, a comma, a digit, a newline, …) different in there.

    don’t know if you did already, but if not you could force AO not to aggregate any inline CSS or JS (which in 99.9% of the use cases are the reason for cache-misses and hence cache size increases) by using the API;

    add_filter('autoptimize_js_include_inline','gad81_ao_include_inline',10,1);
    add_filter('autoptimize_css_include_inline','gad81_ao_include_inline',10,1);
    function gad81_ao_include_inline() {
            return false;
    	}

    For AO 2.0 enabling/ disabling inline aggregation will become an option in the settings-screen (replacing the “look only in head”-options).

    frank

    Thread Starter gab81

    (@gab81)

    hey Frank, let’s give it a go…

    sorry for the noob question here, how do I “use” the API? do I need to add those lines to autoptimize.php ?

    tnx
    Gab

    Plugin Author Frank Goossens

    (@futtta)

    how do I “use” the API? do I need to add those lines to autoptimize.php ?

    No, add that code to your (child) theme’s functions.php (do take into account that theme updates would remove the code) or into a seperate mini-plugin.

    frank

    Thread Starter gab81

    (@gab81)

    seems something’s wrong… I added it and I get

    add_filter(‘autoptimize_js_include_inline’,’gad81_ao_include_inline’,10,1); add_filter(‘autoptimize_css_include_inline’,’gad81_ao_include_inline’,10,1); function gad81_ao_include_inline() { return false; }

    displayed at the top of the page…

    Plugin Author Frank Goossens

    (@futtta)

    well, where did you add it? is it in between php-tags to ensure it gets executed?

    Thread Starter gab81

    (@gab81)

    got it ?? seems to work now, I can see javascript now that is “expanded” in the code.

    let’s see what happens, I will leave it for a few days.

    thanks again Frank!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Cache folder getting big over time’ is closed to new replies.