Moodle uses the word cache to describe many things:

  • MUC, the Moodle Universal Cache.
  • cachedir, usually "{$CFG->dataroot}/cache", used by cachestore_file as the default location for cache data.
  • localcachedir, usually "{$CFG->dataroot}/localcache", the directory where Moodle writes concatenated JS, rendered theme templates and other temporary files that don't need to be consistent across servers.
  • The component cache (relocated with $CFG->alternative_component_cache, usually "{$CFG->cachedir}/core_component.php"), which stores the plugin versions and classmap.

What the MUC is happening?

MUC is a Moodle subsystem used to offload queries usually directed at the database server at alternative sources of the data. By default it's file-backed (using cachestore_file), requiring a share common to each of the application servers. In larger deployments it's advisable to use a faster key-value store that's better optimised for such heavy read volume.

You should read the upstream documentation, but in summary:

  • There are multiple cache types with different scopes:
    • Request, which is valid only within an individual request.
    • Session, which is valid only for a single user session and generally used to persist selections (e.g. bulk user actions, search filters).
  • Application, which is global.
  • Cache definitions are made at these types.
  • Storage and retrieval is done via cache stores, which can be assigned to cache definitions.