# HG changeset patch # User Alain Mazy # Date 1765463704 -3600 # Node ID 32a8ecbf7cf1ae3817eaf0dfbbfcbca1344e158a # Parent ee8a86e2d3cbd1633916f8817319e22ebc7e8a1c fix cache hit/miss diff -r ee8a86e2d3cb -r 32a8ecbf7cf1 Framework/OrthancInstancesCache.cpp --- 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_; - } }