diff OrthancStone/Sources/Toolbox/ParsedDicomCache.cpp @ 1714:a878e807cd96

configuration option "DicomCacheSize", warning if cache should be larger
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Nov 2020 17:57:10 +0100
parents 59f95b9ea858
children 9ac2a65d4172
line wrap: on
line diff
--- a/OrthancStone/Sources/Toolbox/ParsedDicomCache.cpp	Mon Nov 30 17:09:46 2020 +0100
+++ b/OrthancStone/Sources/Toolbox/ParsedDicomCache.cpp	Mon Nov 30 17:57:10 2020 +0100
@@ -82,6 +82,17 @@
                                  bool hasPixelData)
   {
     LOG(TRACE) << "new item stored in cache: bucket " << bucket << ", key " << bucketKey;
+
+    if (lowCacheSizeWarning_ < fileSize &&
+        cache_.GetMaximumSize() > 0 &&
+        fileSize >= cache_.GetMaximumSize())
+    {
+      lowCacheSizeWarning_ = fileSize;
+      LOG(WARNING) << "The DICOM cache size should be larger: Storing a DICOM instance of "
+                   << (fileSize / (1024 * 1024)) << "MB, whereas the cache size is only "
+                   << (cache_.GetMaximumSize() / (1024 * 1024)) << "MB wide";
+    }
+    
     cache_.Acquire(GetIndex(bucket, bucketKey), new Item(dicom, fileSize, hasPixelData));
   }