# HG changeset patch # User Sebastien Jodogne # Date 1573068440 -3600 # Node ID cc029987b6dc5f51b58e187d8565a141b186a717 # Parent 42581a6182c8fd75b6b4e171fb15760686119522 improved cache key diff -r 42581a6182c8 -r cc029987b6dc Framework/Oracle/GenericOracleRunner.cpp --- a/Framework/Oracle/GenericOracleRunner.cpp Wed Nov 06 17:54:14 2019 +0100 +++ b/Framework/Oracle/GenericOracleRunner.cpp Wed Nov 06 20:27:20 2019 +0100 @@ -249,14 +249,13 @@ virtual void Handle(Orthanc::ParsedDicomFile* dicom, const ParseDicomFileCommand& command, + const std::string& path, uint64_t fileSize) = 0; static void Apply(IDicomHandler& handler, - const std::string& root, + const std::string& path, const ParseDicomFileCommand& command) { - std::string path = GetPath(root, command.GetPath()); - if (!Orthanc::SystemToolbox::IsRegularFile(path)) { throw Orthanc::OrthancException(Orthanc::ErrorCode_InexistentFile); @@ -298,7 +297,7 @@ if (ok) { - handler.Handle(new Orthanc::ParsedDicomFile(dicom), command, fileSize); + handler.Handle(new Orthanc::ParsedDicomFile(dicom), command, path, fileSize); } else { @@ -325,6 +324,7 @@ virtual void Handle(Orthanc::ParsedDicomFile* dicom, const ParseDicomFileCommand& command, + const std::string& path, uint64_t fileSize) { std::auto_ptr parsed(dicom); @@ -359,6 +359,7 @@ virtual void Handle(Orthanc::ParsedDicomFile* dicom, const ParseDicomFileCommand& command, + const std::string& path, uint64_t fileSize) { std::auto_ptr parsed(dicom); @@ -371,7 +372,7 @@ // Store it into the cache for future use assert(cache_); - cache_->Acquire(command.GetPath(), parsed.release(), + cache_->Acquire(path, parsed.release(), static_cast(fileSize), command.IsPixelDataIncluded()); } }; @@ -384,11 +385,13 @@ const std::string& root, const ParseDicomFileCommand& command) { + const std::string path = GetPath(root, command.GetPath()); + #if 1 if (cache.get()) { { - ParsedDicomFileCache::Reader reader(*cache, command.GetPath()); + ParsedDicomFileCache::Reader reader(*cache, path); if (reader.IsValid() && (!command.IsPixelDataIncluded() || reader.HasPixelData())) @@ -402,17 +405,17 @@ } DicomHandlerWithCache handler(receiver, emitter, cache); - IDicomHandler::Apply(handler, root, command); + IDicomHandler::Apply(handler, path, command); } else { // No cache available DicomHandlerWithoutCache handler(receiver, emitter); - IDicomHandler::Apply(handler, root, command); + IDicomHandler::Apply(handler, path, command); } #else DicomHandlerWithoutCache handler(receiver, emitter); - IDicomHandler::Apply(handler, root, command); + IDicomHandler::Apply(handler, path, command); #endif }