MDL-83185 core_courseformat: Allow global state cache invalidation

This commit is contained in:
ferran
2024-11-04 06:14:06 +01:00
committed by Laurent David
parent acff633e39
commit 1716e2f2cd
4 changed files with 103 additions and 0 deletions
+14
View File
@@ -283,6 +283,20 @@ abstract class base {
return self::session_cache_reset($course);
}
/**
* Prune a course state cache for all open sessions.
*
* Most course edits does not require to invalidate the cache for all users
* because the cache relies on the course cacherev value. However, there are
* actions like editing the groups that do not change the course cacherev.
*
* @param \stdClass $course
* @return void
*/
public static function invalidate_all_session_caches_for_course(stdClass $course): void {
\cache_helper::invalidate_by_event('changesincoursestate', [$course->id]);
}
/**
* Returns the format name used by this course
*