Categories
LMS Moodle

Moodle’s Cache (MUC) Configuration Location

First of all, caching is important. A cache is a collection of processed data that is kept on hand and re-used to avoid costly repeated database queries. The default cache setting is quite good but if you are running a big Moodle instance or you using cloud services where the IOPS is limited you need to set another caching approach. For this reason, I had to set up a Redis caching backend.

Moodle's Cache Administration page
Moodle’s Cache Administration page

In case you move your Moodle to another place or server you might realize that your Moodle becomes really slow. The reason might be the use of a Mongo or Redis cache. If you forget to switch them off before moving the Moodle app to a new server then you may need to change the settings after the migration.

Redis cache store configuration

For the first time, it was hard for me to find where can I set the settings of my Redis server. I had to navigate through Moodle but it was really-really slow. So I decided to search where Moodle stores the configuration for the caches.
I started to search in the database but it cannot be found there. Then I checked the source files and it turned out that Moodle is storing the configuration at:

/pathtoyourmoodledata/muc/config.php

In this file, it was easy to change the setting to change the IP of the new Redis server.

'BACache' =>
    array (
      'name' => 'BACache',
      'plugin' => 'redis',
      'configuration' =>
      array (
        'server' => '10.10.4.4',
        'prefix' => 'GL17',
        'password' => '',
        'serializer' => '1',
      ),
      'features' => 26,
      'modes' => 3,
      'mappingsonly' => false,
      'class' => 'cachestore_redis',
      'default' => false,
      'lock' => 'cachelock_file_default',
    ),

And that’s all.
Cheers,

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.