Support » Plugin: Autoptimize » Auto Delete Cache

  • Resolved shalintj



    Is there a way to auto-delete the cache? Say every 24 hours or 48 hours. I have been getting cache size warning emails every 18-24 hours.

    I understand unchecking inline JS can help address the cache oversize problem but was hoping to check if there’s a feature to auto-delete cache at regular intervals?

Viewing 15 replies - 1 through 15 (of 19 total)
  • Plugin Author Frank Goossens


    there’s no auto-delete no (see FAQ for some explanation), uncheck inline JS or exclude “random” inline JS from optimization (can be difficult to identify though).


    Thread Starter shalintj


    Thanks for the prompt response.. I have checked the FAQs page too.

    Do you think you can include an option to auto-delete cache in the forthcoming versions of AO?

    Plugin Author Frank Goossens


    Well, auto-deleting the cache only solves one problem you’re having (disk space), but there are 2 other problems -which I consider more important- which auto-cleaning can never solve:
    1. you will be generating new autoptimized JS very regularly, which slows your site down for users who happen to be the unlucky ones requesting that page
    2. a visitor going from page X to page Y will very likely have to request a different autoptimized JS file for page Y instead of using the one from page X from cache, again slowing your site down

    So I actually consider the cache-size warning a like a canary in the coal mines; if the canary dies, you know there’s a bigger problem.

    You don’t (or shouldn’t) really want me to take away the canary! 🙂


    Thread Starter shalintj


    Frank, that was quite an extensive reply. Many thanks for that.

    So, let me go ahead and disable aggregation of inline JS. Just one quick query. Do you think I should then Force JavaScript in <head>? My site gets around 1 post a day, 60-75 comments and 20K hits a day.

    Plugin Author Frank Goossens


    it’s better (from a perf. point of view) not forced in head actually.

    Thread Starter shalintj


    Awesome.. Thanks for the help Frank.. Have a joyous weekend ahead!

    I just found autoptimize 2 days ago and I love it. I had just gotten the email about the cache being large (around 650 mb), and I have PLENTY of disk space, so I am unsure as to why I would want to clean it about once a day (which, judging by today, will be about how often it fills up). I have a new site, with little traffic besides bots so far. once humans arrive,the cache may fill MUCH quicker.

    Perhaps you could make a blog post about WHY one *should* clear the cache and maybe further explain the “Canary in the coal mine” analogy as it pertains to the cache (leaving it or clearing it). I know what the reference is, I just don’t understand how it applies to cache notifications, the warning to delete the cache, and why it is so important to clear the cache.

    Thanks in advance for an explanation if one comes, and a huge thank you for the plugin; it proved itself IMMEDIATELY once deployed on my test site. It made it on the main site in under an hour, I think. So thanks and very well done!

    Plugin Author Frank Goossens


    well, I tried explaining the canary in the coal-mine analogy in this blogpost of mine 🙂

    if your cache is growing quickly, the canary isn’t feeling too well due to accumulating coal-mine gasses. clearing the cache would be the same as taking the canary out of the coal-mine for a couple of minutes, bringing it back in and seeing it feels bad almost immediately after, because even if you cleared the cache your users will still be impacted (different JS-files per page + longer time to create the autoptimized code slowing page load down as well).

    hope this helps understanding that you really should look for the root cause (are you aggregating inline JS?) and fix that instead of clearing the cache repeatably.


    yeah, i guess i needed to hear it 2 different ways to understand what you meant…

    if i read between the lines, I am reading that whatever I am doing, I am creating too much gas in the mine too quickly (especially since the site really doesn’t have any human interactions just yet), and taking the canary outside for some air is like putting my fingers in the dyke (to mix metaphors) as clearing the cache is only a temporary solution

    in other words, i guess I am asking this: is that fast of an accumulation of cache an indication that I am doing something wrong, either in configuring your plugin or in the way I manage my site?

    i do use some sophisticated behaviors such as using powerful plugins like context aware sidebars and plugin logic to control what content certain classes of visitor see and also what plugins are active on any particular class of pages, which could effect your x page to y page analogy in a big way, exponentially multiplying the alphabetic variables in your equation

    if a large cache is a side effect to such micromanaging of content delivery, but if i have plenty of space for the cache to reside on, is this a bad thing? is this the same as the canary dying without being taken outside?

    or is the very rapid large cache more of an indication of bad coding and/or implementation of desired outcomes?

    in other words, is the large cache simply a side effect of design decisions and inevitable, and as long as i have the space, let it be, or is it something i need to get to the root cause of immediately because something is potentially very wrong with my infrastructure, either in the way I have structured things or in the way I have configured your plugin?

    thanks again for your response. i DID read your blog post, but i needed to hear it in a different way as that 1st post didnt click with me as to why you were using that analogy. your subsequent answer here clarified it somewhat, but the basic crux of my question remains; is a huge cache a bad thing if you have the space to handle it and/or your structure seems to need this?

    your plugin rocks. anyone on the fence needs to just test and disable whatever else they were using, then install yours and test. they can uninstall yours and put the old one back, but if they see the results in the tests like i did, they would be foolish to do so. thanks again!

    Plugin Author Frank Goossens


    is it something i need to get to the root cause of immediately because something is potentially very wrong with my infrastructure, either in the way I have structured things or in the way I have configured your plugin?

    Yes you should look into the root cause, and yes it’s AO configuration 🙂

    there are 2 reasons your cache might get big;
    1. lots of JS- (or CSS-) code to optimize means larger files. this is not a big problem, and could be fixed by disabling (or selectively loading) plugins.
    2. inline JS that contains per-page or per-request changing variables. this breaks the AO cache badly, meaning you’ll end up with a lot of (potentially big, if the first bullet also applies) files in cache (each of which having been optimized which takes CPU).

    if you just have big files, but not a lot of them, this means visitors will in general only have to load the (big) autoptimized file once, after which it can be used from cache. if you have lots of files, this will very likely mean your visitors will have to request different autoptimized files for each page they visit.

    fixing (2) can be easy though; either simply don’t aggregate inline JS (aggregating inline CSS is almost always ok, although there are exceptions) OR exclude the per-page or per-request changing variables from being optimized.


    exclude the per-page or per-request changing variables from being optimized

    any tutorials, faqs, or howtos about this point?

    i appreciate all of your help, btw.

    Plugin Author Frank Goossens


    it’s not really straightforward, but this blogpost tries to explain the process.

    hope this helps,

    Thank you.

    I am going to leave you with a plugin that can completely solve page specific problems that your plugin causes

    well, your plugin doesnt actually cause them, it just manipulates data in a way that that data may cause problems

    anyway, i mentioned it before, but last night i found a problem with your plugin and another plugin i had installed.

    while the link you posted would most likely be a solution to those more technically competent than myself, it is more than i can handle. but i already had a solution. it works efficiently for non site specific issues, particularly on page specific issues; it is a plugin called “Plugin Logic.”

    I initially got it to help lower requests on my home page by deactivating unneeded plugin calls, but soon found another side effect. A plugin borking an unrelated page? Deactivate it on that page if it is not being critically used.

    Instead of offering support that vaguely helps an iggy like me, perhaps this may be a very blunt, but also very elegant solution for novices such as myself. Deactivate your plugin on specific pages or ranges of pages and specific problems are instantly solved.

    You gave me an awesome plugin. I am giving you a tool for your arsenal! I hope it helps. Thanks again

    I have a question.

    What do I do if…

    Keeping Optimize Javascript checked but unchecking the aggregate option breaks certain aspects of my site? I noticed that when I do this my product pages no longer show the variation selection options.

    Having it like this still gives me A(100)/A(100%) in GTmetrix, however if I uncheck Optimize Javascript completely, my variations come back but my GTmetrix score goes down to A(98)/B(87%)…

    Is it possible for me to fix the variations while maintaining a A(100)/A(100%) and resolve my issue with my cache filling up every day, all at the same time?

    If not, what do you recommend I do? Should I leave JavaScript un-optimized and ignore the fact that my GTmetrix score is not good? Or should I Optimize and aggregate Javascript and just clear my cache manually everyday? Or is there another option that I’m not aware of?

    Any advice would be greatly appreciated,


    • This reply was modified 5 years, 10 months ago by marketing2.
    Plugin Author Optimizing Matters


    Is it possible for me to fix the variations while maintaining a A(100)/A(100%) and resolve my issue with my cache filling up every day, all at the same time?

    if something breaks when “also aggregate inline JS” is off, that implies that the inline JS requires other JS to be available early, so you will need to exclude one or more files from optimization (often js/jquery/jquery.js but possible others). this will indeed lower your pagespeed score, but there’s no magical fix for that I’m afraid.

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Auto Delete Cache’ is closed to new replies.