input/cache: first draft of the file cache
This commit is contained in:
doc
src
Instance.cxxInstance.hxxMain.cxxPartition.cxxPartition.hxx
config
decoder
input
player
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user