# HG changeset patch # User Alain Mazy # Date 1656483028 -7200 # Node ID 2b3b0ab88c1dc21129f732be053a2f94da15e958 # Parent a9ca92ecbbc2e574843399925fe5d2d06631d12c fix storage cache diff -r a9ca92ecbbc2 -r 2b3b0ab88c1d NEWS --- a/NEWS Tue Jun 28 18:41:27 2022 +0200 +++ b/NEWS Wed Jun 29 08:10:28 2022 +0200 @@ -15,6 +15,12 @@ accessing series : 0040,0275". Main dicom sequences can now be returned in "MainDicomTags" and in "RequestedTags". +Bug Fixes +--------- + +* Fix the storage cache that was not used by the Plugin SDK. This fixes the + DicomWeb plugin "/rendered" route performance issues. + Maintenance ----------- diff -r a9ca92ecbbc2 -r 2b3b0ab88c1d OrthancFramework/Sources/FileStorage/StorageAccessor.cpp --- a/OrthancFramework/Sources/FileStorage/StorageAccessor.cpp Tue Jun 28 18:41:27 2022 +0200 +++ b/OrthancFramework/Sources/FileStorage/StorageAccessor.cpp Wed Jun 29 08:10:28 2022 +0200 @@ -156,31 +156,23 @@ void StorageAccessor::Read(std::string& content, const FileInfo& info) { - switch (info.GetCompressionType()) + if (!cache_.Fetch(content, info.GetUuid(), info.GetContentType())) { - case CompressionType_None: + switch (info.GetCompressionType()) { - if (!cache_.Fetch(content, info.GetUuid(), info.GetContentType())) + case CompressionType_None: { MetricsTimer timer(*this, METRICS_READ); std::unique_ptr buffer(area_.Read(info.GetUuid(), info.GetContentType())); buffer->MoveToString(content); + + break; } - break; - } - - case CompressionType_ZlibWithSize: - { - ZlibCompressor zlib; + case CompressionType_ZlibWithSize: + { + ZlibCompressor zlib; - std::string cached; - if (cache_.Fetch(cached, info.GetUuid(), info.GetContentType())) - { - zlib.Uncompress(content, cached.empty() ? NULL : cached.c_str(), cached.size()); - } - else - { std::unique_ptr compressed; { @@ -189,15 +181,18 @@ } zlib.Uncompress(content, compressed->GetData(), compressed->GetSize()); + + break; } - break; + default: + { + throw OrthancException(ErrorCode_NotImplemented); + } } - default: - { - throw OrthancException(ErrorCode_NotImplemented); - } + // always store the uncompressed data in cache + cache_.Add(info.GetUuid(), info.GetContentType(), content); } // TODO Check the validity of the uncompressed MD5?