MDL-72991 Course: Partial course cache rebuild
When updating/deleting a section/module, the system now only invalidate of the element (section/module), not the whole course cache Also, the system now only recalculate the cache for element (section/module) if necessary, not the whole course cache Move module/section purging to course_modinfo: + course_modinfo::purge_course_section_cache_by_id was created to purge section by id + course_modinfo::purge_course_section_cache_by_number was created to purge section by number + course_modinfo::purge_course_module_cache was created to purge module
This commit is contained in:
committed by
Huong Nguyen
parent
967d9b2546
commit
f97b86e841
@@ -292,14 +292,16 @@ class condition extends \core_availability\condition {
|
||||
$updatesection->availability = json_encode($tree->save());
|
||||
$updatesection->timemodified = time();
|
||||
$DB->update_record('course_sections', $updatesection);
|
||||
// Invalidate the section cache by given section id.
|
||||
\course_modinfo::purge_course_section_cache_by_id($courseid, $section->id);
|
||||
|
||||
$anychanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure course cache is cleared if required.
|
||||
if ($anychanged) {
|
||||
rebuild_course_cache($courseid, true);
|
||||
// Partial rebuild the sections which have been invalidated.
|
||||
rebuild_course_cache($courseid, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user