MAX_MODINFO_CACHE_SIZE constant value

MAX_MODINFO_CACHE_SIZE constant value

av Евгений Мамаев -
Antal svar: 5
Bild på Plugin developers

Hi!

I currently make some optimizations to my Moodle site (3.11.x) and found this constant MAX_MODINFO_CACHE_SIZE

in /lib/modinfolib.php file

// Maximum number of modinfo items to keep in memory cache. Do not increase this to a large
// number because:
// a) modinfo can be big (megabyte range) for some courses
// b) performance of cache will deteriorate if there are very many items in it

The default value is 10. What number is meant by "the large number"? Is 20 or 30 the large number?

Do I need to increase this value if most of my users enrolled to 15-25 courses?

Genomsnitt av betyg: -
Som svar till Евгений Мамаев

Re: MAX_MODINFO_CACHE_SIZE constant value

av Howard Miller -
Bild på Core developers Bild på Documentation writers Bild på Particularly helpful Moodlers Bild på Peer reviewers Bild på Plugin developers
I would strongly recommend that you stop chaning Moodle core code. You're just making it hard for yourself to upgrade.

The message isn't for end users. If this needed to be a user setting (or even a config setting in config.php) then it would be.
Som svar till Howard Miller

Re: MAX_MODINFO_CACHE_SIZE constant value

av Евгений Мамаев -
Bild på Plugin developers
I don't change core code, I changed this value in config.php
Som svar till Евгений Мамаев

Re: MAX_MODINFO_CACHE_SIZE constant value

av Howard Miller -
Bild på Core developers Bild på Documentation writers Bild på Particularly helpful Moodlers Bild på Peer reviewers Bild på Plugin developers
I'm confused because, unless I'm missing something, it's specified as a constant in lib/modinfolib.php (the file you mentioned). It's not a $CFG setting in config.php
Som svar till Howard Miller

Re: MAX_MODINFO_CACHE_SIZE constant value

av Евгений Мамаев -
Bild på Plugin developers
I just added
define('MAX_MODINFO_CACHE_SIZE', 10);
in config.php and can change it's value.
I also have increased CONTEXT_CACHE_MAX_SIZE from it's default value 2500 up to 7500 and got noticeable improvement in speed on course pages and on some admin pages.
All this is not measured in any way with speed tests or some other tools, just by opening a page and noticing a difference. No other config values or server settings (including database) were changed