• Resolved blau

    (@blau)


    It seems that on my installs autoptimize couldo do with some garbage collection – I end up with an 80GB /wp-content/cache/autoptimize containing 2.5 million files.

    This would be ok except that during upgrades the server chokes trying to get hold of the cache.

    Is there something I can do to enforce periodic cache purge?

    https://www.ads-software.com/plugins/autoptimize/

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

    (@futtta)

    There is no automatic purge I’m afraid Blau. In general the cache size becomes huge if you have some (js) code which is different for each page (or even every page load), in which case a new aggregated file is created. In that case the easiest solution would be to:

    1. disable JS optimization
    2. look at the HTML source of 2 very similar pages and find the javascript that is different between those 2 pages
    3. inside that different javascript find a string that is common (e.g. in “var naughty_js = <random_value>” that would be “naughty_js”
    4. go to the autoptimize settings page and make sure the advanced settings are shown
    5. add the string from (3) to “Exclude scripts from Autoptimize:” (which is a comma-seperated list).
    6. re-enable JS optimization

    hope this helps,
    frank

    Thread Starter blau

    (@blau)

    Hi Frank, thank you for your reply.

    Would it be feasible to have a cron job clear the cache, say, weekly? What would the command be? This one?

    https://www.example.com/wp-admin/options-general.php?page=autoptimize&settings-updated=true

    Plugin Author Frank Goossens

    (@futtta)

    No, you’d have to do this from PHP:

    autoptimizeCache::clearall();

    The problem with automatic cache pruning is that it is entirely possible that a page caching layer (which could be a browser, a caching reverse proxy or a wordpress page caching plugin) could contain pages that refer to the aggregated JS/CSS-files you would delete with the purge, which would severly break the page.

    So although cache purging is on my wishlist, I don’t have a good idea of how to tackle that problem yet.

    Thread Starter blau

    (@blau)

    I see. I will keep an eye on the cache to see if it grows again. Thank you for your time.

    Edit: 1000 files in 20 minutes. Disabled js optimizing and let’s see.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘garbage collection’ is closed to new replies.