summaryrefslogtreecommitdiff
path: root/src/WrDiskCache.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/WrDiskCache.cc')
-rw-r--r--src/WrDiskCache.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/WrDiskCache.cc b/src/WrDiskCache.cc
index 79af80e9..cd204ea6 100644
--- a/src/WrDiskCache.cc
+++ b/src/WrDiskCache.cc
@@ -112,12 +112,12 @@ void WrDiskCache::ensureLimit()
{
while(total_ > limit_) {
EntrySet::iterator i = set_.begin();
- total_ -= (*i)->getSize();
- (*i)->writeToDisk();
WrDiskCacheEntry* ent = *i;
A2_LOG_DEBUG(fmt("Force flush cache entry size=%lu, clock=%"PRId64,
static_cast<unsigned long>(ent->getSizeKey()),
ent->getLastUpdate()));
+ total_ -= ent->getSize();
+ ent->writeToDisk();
set_.erase(i);
ent->setSizeKey(ent->getSize());