From: skodak Date: Tue, 29 Jan 2008 17:30:46 +0000 (+0000) Subject: MDL-13237 rceche limiting through intcachemax finally implemented - this should preve... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=56edc4490dd3d894d3380c3d81c449a1fa9d2653;p=moodle.git MDL-13237 rceche limiting through intcachemax finally implemented - this should prevent major memory leaks; merged from MOODLE_19_STABLE --- diff --git a/lib/dmllib.php b/lib/dmllib.php index a767ca4153..8f885070ba 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -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;