]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-13237 rceche limiting through intcachemax finally implemented - this should preve...
authorskodak <skodak>
Tue, 29 Jan 2008 17:30:46 +0000 (17:30 +0000)
committerskodak <skodak>
Tue, 29 Jan 2008 17:30:46 +0000 (17:30 +0000)
lib/dmllib.php

index a767ca4153bc184cea3db0b63ee5c16d283cf884..8f885070ba3c58b1eb48ecbe8b3d9607c2fbf2a7 100644 (file)
@@ -2572,6 +2572,12 @@ function rcache_set($table, $id, $rec) {
     global $CFG, $MCACHE, $rcache;
 
     if ($CFG->cachetype === 'internal') {
+        if (!isset($rcache->data[$table])) {
+            $rcache->data[$table] = array();
+        }
+        if (!isset($rcache->data[$table][$id]) and count($rcache->data[$table]) > $CFG->intcachemax) {
+            array_shift($rcache->data[$table]);
+        }
         $rcache->data[$table][$id] = clone($rec);
     } else {
         $key   = $table . '|' . $id;