diff --git a/lib/coursecatlib.php b/lib/coursecatlib.php index d8ce7b8cfa9..e5edde1a17b 100644 --- a/lib/coursecatlib.php +++ b/lib/coursecatlib.php @@ -626,9 +626,7 @@ class coursecat implements renderable, cacheable_object, IteratorAggregate { } // We must add countall to all in case it was the requested ID. $all['countall'] = $count; - foreach ($all as $key => $children) { - $coursecattreecache->set($key, $children); - } + $coursecattreecache->set_many($all); if (array_key_exists($id, $all)) { return $all[$id]; }