SugarCRM cache directory – it is NOT a cache directory!

SugarCRM has a difrectory called “cache”. When the application runs, PHP scripts, JavaScript, CSS, images and so on, are cached in there. This is how SugarCRM allows modules to plug into other modules; the cached PHP scripts combine together lots of smaller scripts across the full range of modules.

But that is not all the cache directory holds.

There are also email passwords, encrypted with Blowfish. There are emails, and email attachments. There are uploaded documents and files. These are not cache items. These are data, and have just ended up in the cache directory through historical accident.

What this means is that when you want to clear out the cache, be very careful what you delete in there. Also when migrating sites, don’t forget to pull the cache directory along too.

Here is a list of the main directories under the cache directory, with notes against those where you need to be careful. This is for the Community Edition (CE) and is unlikely to be the complete list when you take additional modules you may have installed into account.

Directory Description Deletable?
cache/ The root directory holding cache files and data. No
cache/blowfish/ The encryption keys used to encrypt and decrypt email system passwords.Deleting this will mean the email login passwords can no longer be decrypted, and so the passwords will all need to be entered again. No
cache/csv/ Temporary storage for CSV files that are being exported. Yes
cache/dashlets/ Cache of dashlet PHP scripts, built from source scripts as needed. Yes
cache/diagnostics/ Store for diagnostics when you run SugarCRM’s diagnostics tool. Yes
cache/dynamic_fields/ Cache of custom modules and fields, pulling together many smaller files into larger files for speed.A “Quick Repair and Rebuild” will rebuild this directory. Yes
cache/feeds/ Temporary cache of users’ RSS feeds. Yes
cache/generated_forms/ Where web-to-lead capture forms are stored when they are generated.Whether these can be deleted, depends on whether you use them in-situ, or copy them for use in an external website. Depends
cache/images/ Contains many different types of data. Do not touch. For the Community Edition (CE) this contains images that are temporarily cached before attaching to emails. For the non-CE versions, it contains much more permanent images related to the Knowledge Base. No
cache/import/ Temporary cache area for uploaded CSV files, e.g. lists of contacts or leads. Yes
cache/jsLanguage/ JavaScript versions of the language files, providing localisation for JavaScript functions at the front end. Yes
cache/modules/ Caches code for modules, templates, views, vardefs etc.Most of these files can be deleted, but some of the subdirectories can not. See below for more details. Partially
cache/modules/emails/ Directories for emails stored within SugarCRM.Each directory will link to a user that uses the built-in email capabilities of SugarCRM. No
cache/pdf/ Temporary store for PDFs that are generated for end users. Yes
cache/smarty/ Caches and configuration files for the Smarty templating engine. No
cache/upload/ All uploaded files, e.g. documents uploaded as notes, email attachments, uploaded modules. No
cache/xml/ Temporary files used to create graphs. Yes

Folders that can be deleted (“Yes”) will generally be rebuilt automatically as needed.

Update for SugarCRM 6.5.8:

It looks like there are a few changes, and these affect the SugarCRM .gitignore script too.

  • The cache/blowfish folder has moved to custom/blowfish
  • There are some new folders: cache/htmlclean, cache/include, cache/layout, cache/Relationships, cache/themes, cache/upgrades

I suspect most of these new folders have just moved from other locations.



  1. SugarCRM CE Codebase Improvements Wishlist | Academe Computing - November 26, 2013

    […] is called a cache directory, but it far from being a cache directory. For example, the image uploads directory is one, big, flat directory. Once you have users […]

Leave a Reply

Powered by WordPress. Designed by Woo Themes