7

There are a number of ways to flush Magento cache, with slight differences. I have always been a bit confused about these and often end up overdoing it when deleting the cache. This my understanding of it as it is but maybe someone could correct this and answer my questions. I am hoping this question could be a source covering all aspects of cache ... I haven't found another question here which answers all questions in one.

Selecting individual lines using checkboxes and selecting refresh Surgically deleting a particular area of cache.

Pressing "Flush Magento Cache" Same as selecting and refreshing ALL from above (BTW anyone know why this operation is referred to as flush and the previous as refresh?)

Flush Cache Storage Same as last option but also includes some cache which may be shared 'by other applications' What applications for instance?

Flush Catalog Images Cache and Flush Javascript/CSS Cache As the name suggests ... Is this included in either of the last 2 options? BTW I think it must be important to also flush browser cache if using this. Correct?

Deleting contents of /var/cache and /var/sessions The nuclear option ? ... Does this delete absolute everything including javascript/css and catalog images cache; or what is not covered by this? Is there any other folders which should be included when doing a manual delete. I seem to remember hearing about another folder but I can't remember which one.

If anyone else has any other questions they might want to edit this and add the questions.

1 Answer 1

12

Flush and refresh: Refreshing means that it cleans up alle the invalidated cache keys. for example: when you save a widget while the cache is active you get a message that the cache is invalid. In this instance you don't need to flush the cache, just refresh it. Flushing means that it throws all the cache away, it will rebuild everything from scratch.

CSS/Javascript cache: This cache is separate from the default cache. The normal cache will store in a cache-backend. That can be the var/cache/ folder, it can be memcache or redis, etc. The CSS/JS cache is stored in the media/css and media/js folders (you can thus safely delete those folders at will). Flushing browser cache is a good idea, certainly if cache headers are set up. You can also auto-version your css/js files to fix this: https://github.com/fbrnc/Aoe_JsCssTstamp

Flush Cache Storage/Flush Magento Cache: If you flush the magento cache storage it will flush all the cache options that are mentioned in the cache-table. If you flush the cache storage, everything is flushed. By default there is some database caching used by Zend that only get flushed this way.

Deleting contents of /var/cache and /var/sessions: When deleting var/cache everything is flushed except css/js (those are in the media folder). To remove sessions you need to delete the var/sessions folder (you can also store sessions in the database or redis/memcache), but you'll rarely have to. Doing this on a live server may cause problems (carts get lost).

3
  • Thanks - I'll give you the tick for now unless someone manages to do better somehow but that's very comprehensive. Commented Apr 18, 2014 at 18:11
  • one quetsion - when people say "you need to flush cache" would this typically mean just pressing "Flush Magento Cache" Commented Apr 18, 2014 at 18:13
  • 1
    Just flush the Magento cache storage, that one is the most thorough. Commented Apr 19, 2014 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.