Branch: Tag:

2017-04-03

2017-04-03 12:12:24 by Anders Johansson <anders@roxen.com>

RAM Cache: Fixed accounting when replacing an entry

Accounting was never adjusted for the removed entry when replacing an
entry.

352:   #endif       if (mapping(mixed:CacheEntry) lm = lookup[cache_name]) { +  CacheEntry old_entry;    // vvv Relying on the interpreter lock from here. -  CacheEntry old_entry = lm[entry->key]; -  lm[entry->key] = entry; -  // ^^^ Relying on the interpreter lock to here. -  -  if (old_entry) { +  while (old_entry = lm[entry->key]) {    recent_added_bytes -= old_entry->size;    remove_entry (cache_name, old_entry);    } -  +  lm[entry->key] = entry; +  // ^^^ Relying on the interpreter lock to here.       cs->count++;    cs->size += entry->size;