diff --git a/lib/coursecatlib.php b/lib/coursecatlib.php
index ee93258..872d574 100644
--- a/lib/coursecatlib.php
+++ b/lib/coursecatlib.php
@@ -703,25 +703,31 @@ protected static function get_records($whereclause, $params) {
      */
     public static function preload_course_contacts(&$courses) {
         global $CFG, $DB;
+
         if (empty($courses) || empty($CFG->coursecontact)) {
             return;
         }
+
         $managerroles = explode(',', $CFG->coursecontact);
         $cache = cache::make('core', 'coursecontacts');
-        $cacheddata = $cache->get_many(array_merge(array('basic'), array_keys($courses)));
-        // Check if cache was set for the current course contacts and it is not yet expired.
-        if (empty($cacheddata['basic']) || $cacheddata['basic']['roles'] !== $CFG->coursecontact ||
-                $cacheddata['basic']['lastreset'] < time() - self::CACHE_COURSE_CONTACTS_TTL) {
-            // Reset cache.
+        $cacheddata = $cache->get_many(array_merge(array('contacts'), array_keys($courses)));
+
+        // Check if cache was set for the current course contacts.
+        if (empty($cacheddata['contacts']) || $cacheddata['contacts'] !== $CFG->coursecontact) {
+            // We need to reset all course info, this may hit large sites but $CFG->coursecontact won't be changed that often.
             $keys = $DB->get_fieldset_select('course', 'id', '');
             $cache->delete_many($keys);
-            $cache->set('basic', array('roles' => $CFG->coursecontact, 'lastreset' => time()));
-            $cacheddata = $cache->get_many(array_merge(array('basic'), array_keys($courses)));
+
+            // Update contacts cache.
+            $cache->set('contacts', $CFG->coursecontact);
+            $cacheddata = array('contacts' => $CFG->coursecontact);
         }
+
+        $resettime = time() - self::CACHE_COURSE_CONTACTS_TTL;
         $courseids = array();
         foreach (array_keys($courses) as $id) {
-            if ($cacheddata[$id] !== false) {
-                $courses[$id]->managers = $cacheddata[$id];
+            if (isset($cacheddata[$id]) && $cacheddata[$id]['lastreset'] > $resettime) {
+                $courses[$id]->managers = $cacheddata[$id]['managers'];
             } else {
                 $courseids[] = $id;
             }
@@ -790,7 +796,10 @@ public static function preload_course_contacts(&$courses) {
         // Set the cache.
         $values = array();
         foreach ($courseids as $id) {
-            $values[$id] = $courses[$id]->managers;
+            $values[$id] = array(
+                'managers' => $courses[$id]->managers,
+                'lastreset' => time()
+            );
         }
         $cache->set_many($values);
     }
