Title: Cache folder getting big over time
Last modified: August 24, 2016

---

# Cache folder getting big over time

 *  Resolved [gab81](https://wordpress.org/support/users/gab81/)
 * (@gab81)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/)
 * hi Frank,
 * is it normal that the cache folder of cache/autoptimize/js gets incrementally
   bigger over time?
 * I can see new .js files written there and it seems is not getting purged, is 
   that normal?
 * thanks,
    Gabrio
 * [https://wordpress.org/plugins/autoptimize/](https://wordpress.org/plugins/autoptimize/)

Viewing 14 replies - 1 through 14 (of 14 total)

 *  [bradenschaeffer](https://wordpress.org/support/users/bradenschaeffer/)
 * (@bradenschaeffer)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133504)
 * Having the same issue with `php` and `php.none` files in the `cache/autoptimize`
   folder.
 *  Thread Starter [gab81](https://wordpress.org/support/users/gab81/)
 * (@gab81)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133526)
 * i do not have those files in cache/autoptimize
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133538)
 * On holiday now, but have a look at the FAQ, it has some great info on this topic.
 *  Thread Starter [gab81](https://wordpress.org/support/users/gab81/)
 * (@gab81)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133563)
 * Btw Frank when you r back from holidays if you can share the 410 process for 
   [https://wordpress.org/support/topic/some-404s](https://wordpress.org/support/topic/some-404s)
   that willbe great 🙂
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133574)
 * Some feedback:
    1. huge cache size typically is due to page- or request-specific
   JS (or CSS) which you should either exclude ([see FAQ](https://wordpress.org/plugins/autoptimize/faq/)),
   or you could tell AO not to aggregate internal JS (or CSS) (see [autoptimize_helper.php_example](http://plugins.svn.wordpress.org/autoptimize/trunk/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](https://wordpress.org/support/users/gab81/)
 * (@gab81)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133582)
 * 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](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133586)
 * 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](https://wordpress.org/support/users/gab81/)
 * (@gab81)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133593)
 * 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 [http://blog.futtta.be/2014/03/19/how-to-keep-autoptimizes-cache-size-under-control-and-improve-visitor-experience/](http://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](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133595)
 * 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](https://wordpress.org/support/users/gab81/)
 * (@gab81)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133599)
 * 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](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133601)
 * > 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](https://wordpress.org/support/users/gab81/)
 * (@gab81)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133603)
 * 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](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133604)
 * well, where did you add it? is it in between php-tags to ensure it gets executed?
 *  Thread Starter [gab81](https://wordpress.org/support/users/gab81/)
 * (@gab81)
 * [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133606)
 * 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.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

## Tags

 * [cache folder](https://wordpress.org/support/topic-tag/cache-folder/)

 * 14 replies
 * 3 participants
 * Last reply from: [gab81](https://wordpress.org/support/users/gab81/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/cache-folder-getting-big-over-time/#post-6133606)
 * Status: resolved