# HG changeset patch # User Sebastien Jodogne # Date 1778655488 -7200 # Node ID 39623af8186d84360dc4a0db19a96f8c123fb131 # Parent e8c6f6cc27f254890be20167c5a31947938b830a allow loaded value to bypass the reader cache diff -r e8c6f6cc27f2 -r 39623af8186d OrthancFramework/Sources/DataSource/DataSourceReader.cpp --- a/OrthancFramework/Sources/DataSource/DataSourceReader.cpp Wed May 13 08:44:52 2026 +0200 +++ b/OrthancFramework/Sources/DataSource/DataSourceReader.cpp Wed May 13 08:58:08 2026 +0200 @@ -70,9 +70,12 @@ boost::shared_ptr value; std::unique_ptr error; - if (cache_) + std::string cacheKey; + bool hasCacheKey = id_->GetCacheKey(cacheKey); + + if (cache_ && hasCacheKey) { - value = cache_->GetCachedValue(id_->GetCacheKey()); + value = cache_->GetCachedValue(cacheKey); } if (!value) @@ -95,9 +98,9 @@ error.reset(new OrthancException(ErrorCode_NullPointer)); } - if (!error && cache_) + if (!error && cache_ && hasCacheKey) { - cache_->Store(id_->GetCacheKey(), value); + cache_->Store(cacheKey, value); } } diff -r e8c6f6cc27f2 -r 39623af8186d OrthancFramework/Sources/DataSource/IDataIdentifier.h --- a/OrthancFramework/Sources/DataSource/IDataIdentifier.h Wed May 13 08:44:52 2026 +0200 +++ b/OrthancFramework/Sources/DataSource/IDataIdentifier.h Wed May 13 08:58:08 2026 +0200 @@ -38,6 +38,7 @@ { } - virtual std::string GetCacheKey() const = 0; + // If this method return "false", the loaded value bypasses the reader cache (if present) + virtual bool GetCacheKey(std::string& key) const = 0; }; }