diff options
Diffstat (limited to 'src/decoder/Bridge.cxx')
-rw-r--r-- | src/decoder/Bridge.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/decoder/Bridge.cxx b/src/decoder/Bridge.cxx index 36f991529..36c269489 100644 --- a/src/decoder/Bridge.cxx +++ b/src/decoder/Bridge.cxx @@ -31,6 +31,8 @@ #include "Log.hxx" #include "input/InputStream.hxx" #include "input/LocalOpen.hxx" +#include "input/cache/Manager.hxx" +#include "input/cache/Stream.hxx" #include "fs/Path.hxx" #include "util/ConstBuffer.hxx" #include "util/StringBuffer.hxx" @@ -52,8 +54,18 @@ DecoderBridge::~DecoderBridge() noexcept } InputStreamPtr -DecoderBridge::OpenLocal(Path path_fs) +DecoderBridge::OpenLocal(Path path_fs, const char *uri_utf8) { + if (dc.input_cache != nullptr) { + auto lease = dc.input_cache->Get(uri_utf8, true); + if (lease) { + auto is = std::make_unique<CacheInputStream>(std::move(lease), + dc.mutex); + is->SetHandler(&dc); + return is; + } + } + return OpenLocalInputStream(path_fs, dc.mutex); } |