MDL-45678 cache: renamed new cache and better comments
authorSam Hemelryk <sam@moodle.com>
Mon, 7 Jul 2014 21:52:41 +0000 (09:52 +1200)
committerSam Hemelryk <sam@moodle.com>
Mon, 7 Jul 2014 21:52:41 +0000 (09:52 +1200)
lang/en/cache.php
lib/accesslib.php
lib/db/caches.php
lib/enrollib.php

index c033cbc..6feeadf 100644 (file)
@@ -46,7 +46,7 @@ $string['cachedef_coursemodinfo'] = 'Accumulated information about modules and s
 $string['cachedef_databasemeta'] = 'Database meta information';
 $string['cachedef_eventinvalidation'] = 'Event invalidation';
 $string['cachedef_externalbadges'] = 'External badges for particular user';
-$string['cachedef_get_suspended_userids'] = 'List of suspended user identifiers per course';
+$string['cachedef_suspended_userids'] = 'List of suspended users per course';
 $string['cachedef_gradecondition'] = 'User grades cached for evaluating conditional availability';
 $string['cachedef_groupdata'] = 'Course group information';
 $string['cachedef_htmlpurifier'] = 'HTML Purifier - cleaned content';
index d280056..bd58f9a 100644 (file)
@@ -7460,7 +7460,7 @@ function extract_suspended_users($context, &$users, $ignoreusers=array()) {
  * or enrolment has expired or not started.
  *
  * @param context $context context in which user enrolment is checked.
- * @param bool $context Enable or disable (default) the request cache
+ * @param bool $usecache Enable or disable (default) the request cache
  * @return array list of suspended user id's.
  */
 function get_suspended_userids(context $context, $usecache = false) {
@@ -7468,7 +7468,7 @@ function get_suspended_userids(context $context, $usecache = false) {
 
     // Check the cache first for performance reasons if enabled.
     if ($usecache) {
-        $cache = cache::make('core', 'get_suspended_userids');
+        $cache = cache::make('core', 'suspended_userids');
         $susers = $cache->get($context->id);
         if ($susers !== false) {
             return $susers;
index 24543b9..e71dc57 100644 (file)
@@ -223,8 +223,9 @@ $definitions = array(
         'simpledata' => true
     ),
 
-    // For the function get_suspended_userids() in core_access.
-    'get_suspended_userids' => array(
+    // Caches suspended userids by course.
+    // The key is the courseid, the value is an array of user ids.
+    'suspended_userids' => array(
         'mode' => cache_store::MODE_REQUEST,
         'simplekeys' => true,
         'simpledata' => true,
index b948388..b65a36e 100644 (file)
@@ -1407,7 +1407,7 @@ abstract class enrol_plugin {
         context_course::instance($instance->courseid)->mark_dirty(); // reset enrol caches
 
         // Invalidate core_access cache for get_suspended_userids.
-        cache_helper::invalidate_by_definition('core', 'get_suspended_userids', array(), array($instance->courseid));
+        cache_helper::invalidate_by_definition('core', 'suspended_userids', array(), array($instance->courseid));
 
         // Trigger event.
         $event = \core\event\user_enrolment_updated::create(