Mercurial > hg > orthanc-transfers
changeset 98:32a8ecbf7cf1
fix cache hit/miss
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Thu, 11 Dec 2025 15:35:04 +0100 |
| parents | ee8a86e2d3cb |
| children | 87a558cf280e |
| files | Framework/OrthancInstancesCache.cpp |
| diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/OrthancInstancesCache.cpp Thu Dec 11 15:08:10 2025 +0100 +++ b/Framework/OrthancInstancesCache.cpp Thu Dec 11 15:35:04 2025 +0100 @@ -53,6 +53,11 @@ instance->second != NULL); instance_ = instance->second; + + { + boost::mutex::scoped_lock lock(cache.cacheStatsMutex_); + ++cache.cacheHitCount_; + } } } @@ -152,6 +157,11 @@ memorySize_ += instance->GetInfo().GetSize(); content_[instanceId] = instance.release(); + { + boost::mutex::scoped_lock lock(cacheStatsMutex_); + ++cacheMissCount_; + } + CheckInvariants(); } } @@ -223,11 +233,6 @@ { size = accessor.GetInfo().GetSize(); md5 = accessor.GetInfo().GetMD5(); - - { - boost::mutex::scoped_lock lock(cacheStatsMutex_); - ++cacheHitCount_; - } return; } } @@ -242,11 +247,6 @@ boost::mutex::scoped_lock lock(mutex_); Store(instanceId, instance); } - - { - boost::mutex::scoped_lock lock(cacheStatsMutex_); - ++cacheMissCount_; - } }
