-
Epic
-
Resolution: Fixed
-
Critical
-
None
-
2.3, 2.6
-
MOODLE_23_STABLE, MOODLE_26_STABLE
-
Course caching
-
100
-
BACKEND Sprint 4
The main goal of this change is to move the content of the fields course.modinfo and course.sectioncache to MUC.
More complete list of changes:
- classes course_modinfo, cm_info, section_cache no longer extend stdClass and all properties are read-only. No more deprecated but still used everywhere public properties - all properties have getters and you can legally use either $modinfo->cms or $modinfo->get_cms()
- classes cm_info and section_cache no longer calculate any data on initialisation and only calculate it when it is needed (saves extra DB queries when conditional availability is enabled).
- database fields course.modinfo and course.sectioncache are removed, new application cache core/coursemodinfo stores this information.
- course cache now additionally stores some fields from 'course' table such as format, enableavailability, groupmode, etc. that are necessary when calculating availability or additional section fields
- new field course.cacherev added to table course and it is incremented every time the course cache is reset. Object in cache stores the value of cacherev at the moment when cache was built. This allows to avoid race conditions when course cache was simultaneously reset and rebuild by different people and became corrupt.
Main changes for users
- less db queries, less RAM usage on heavy pages such as "My courses"
- much less probability of corrupt course cache (hopefully none at all)
- "Purge all caches" purges course caches as well
- Every core upgrade purges course caches
Notes for developers
- Do not access removed fields course.modinfo and course.sectioncache
- If you need the raw user-independed information - call get_fast_modinfo($courseorid, -1)
- Do not try to overwrite/append properties of course_modinfo or cm_info
- do not hint any of those classes as stdClass in function arguments or you'll hit fatal error
- Enjoy IDE hints for the properties and methods in modinfo classes
- When calling get_fast_modinfo() for the list of courses make sure to retrieve/pass field cacherev. Otherwise an extra db query will be made. Not necessary when calling get_fast_modinfo() for current course. Most of core API functions returning list of courses will return you this field anyway.
- has a non-specific relationship to
-
MDL-34785 Course overview block courselimit > MAX_MODINFO_CACHE_SIZE and causes frequent partial resets of the get_fast_modinfo cache
-
- Closed
-
- is blocked by
-
MDL-36789 Corrupt modinfo in course table [problem and a fix]
-
- Closed
-
-
MDL-29731 Recent activities block doesn't show new forum posts when forum is set to "separate groups"
-
- Closed
-
-
MDL-36690 invalid iconurl in LTI module causes corrupt modinfo and course no longer loads.
-
- Closed
-
-
MDL-40830 mod_assign_generator does not clear course cache somewhere
-
- Closed
-
-
MDL-40947 Segmentation fault caused by get_fast_modinfo()
-
- Closed
-
-
MDL-41179 Function cm_info::is_user_access_restricted_by_capability() assumes current user
-
- Closed
-
-
MDL-41222 Course cache is rebuild unnecessarily
-
- Closed
-
- will help resolve
-
MDL-35131 Purge all caches feature does not clear course modinfo cache
-
- Closed
-
-
MDL-33986 We need to force a course cache rebuild on upgrade
-
- Closed
-