changeset 6316:72ae47e6bc4e

fix MaximumStorageCacheSize=0
author Alain Mazy <am@orthanc.team>
date Thu, 18 Sep 2025 15:35:28 +0200
parents 7736dc6c1e49
children 94b94ad90101
files NEWS OrthancFramework/Sources/Cache/MemoryStringCache.cpp OrthancFramework/UnitTestsSources/MemoryCacheTests.cpp
diffstat 3 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Sep 18 15:17:25 2025 +0200
+++ b/NEWS	Thu Sep 18 15:35:28 2025 +0200
@@ -33,6 +33,9 @@
   - Using a "TemporaryDirectory" to save zip file or to export DICOMDIR
   - The "SslCertificate" and other related configurations
 * Fix: DicomGetScu jobs are now saved in DB.
+* Fix: When the configuration option "MaximumStorageCacheSize" was set to 0, the default value (128)
+       was actually applied.  From now on, a value of 0 really means that the storage cache is disabled.
+
 
 Version 1.12.9 (2025-08-11)
 ===========================
--- a/OrthancFramework/Sources/Cache/MemoryStringCache.cpp	Thu Sep 18 15:17:25 2025 +0200
+++ b/OrthancFramework/Sources/Cache/MemoryStringCache.cpp	Thu Sep 18 15:35:28 2025 +0200
@@ -131,11 +131,6 @@
 
   void MemoryStringCache::SetMaximumSize(size_t size)
   {
-    if (size == 0)
-    {
-      throw OrthancException(ErrorCode_ParameterOutOfRange);
-    }
-      
     // // Make sure no accessor is currently open (as its data may be
     // // removed if recycling is needed)
     // WriterLock contentLock(contentMutex_);
--- a/OrthancFramework/UnitTestsSources/MemoryCacheTests.cpp	Thu Sep 18 15:17:25 2025 +0200
+++ b/OrthancFramework/UnitTestsSources/MemoryCacheTests.cpp	Thu Sep 18 15:35:28 2025 +0200
@@ -319,7 +319,7 @@
 TEST(MemoryStringCache, Basic)
 {
   Orthanc::MemoryStringCache c;
-  ASSERT_THROW(c.SetMaximumSize(0), Orthanc::OrthancException);
+  ASSERT_NO_THROW(c.SetMaximumSize(0));  // changed in 1.12.10, setting the MaximumSize to zero is a way to disable a cache
   
   c.SetMaximumSize(3);