MDL-13237 rceche limiting through intcachemax finally implemented - this should prevent major memory leaks; backported from MOODLE_19_STABLE

This commit is contained in:
skodak
2008-01-29 17:52:11 +00:00
parent 89d98b923b
commit a8cd1b57da
+6
View File
@@ -2324,6 +2324,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;