|
| enum class | CachedFileRangeOverlap { NONE
, PARTIAL
, FULL
} |
|
|
BufferManager & | buffer_manager |
| | The BufferManager used to cache files.
|
|
atomic< bool > | enable |
| | Whether or not file caching is enabled.
|
|
unordered_map< string, unique_ptr< CachedFile > > | cached_files |
| | Mapping from file path to cached file with cached ranges.
|
|
mutex | lock |
| | Lock for accessing the cached files.
|
◆ CachedFileRangeOverlap
| enum class duckdb::ExternalFileCache::CachedFileRangeOverlap |
|
strong |
144591{ NONE, PARTIAL, FULL };
◆ ExternalFileCache()
| duckdb::ExternalFileCache::ExternalFileCache |
( |
DatabaseInstance & | db, |
|
|
bool | enable ) |
413367}
atomic< bool > enable
Whether or not file caching is enabled.
Definition duckdb.cpp:144674
BufferManager & buffer_manager
The BufferManager used to cache files.
Definition duckdb.cpp:144672
◆ Get() [1/2]
413395 {
413396 return db.GetExternalFileCache();
413397}
◆ Get() [2/2]
| ExternalFileCache & duckdb::ExternalFileCache::Get |
( |
ClientContext & | context | ) |
|
|
static |
413399 {
413400 return context.db->GetExternalFileCache();
413401}
◆ IsEnabled()
| bool duckdb::ExternalFileCache::IsEnabled |
( |
| ) |
const |
◆ SetEnabled()
| void duckdb::ExternalFileCache::SetEnabled |
( |
bool | enable | ) |
|
413373 {
413374 lock_guard<mutex> guard(
lock);
413378 }
413379}
unordered_map< string, unique_ptr< CachedFile > > cached_files
Mapping from file path to cached file with cached ranges.
Definition duckdb.cpp:144676
mutex lock
Lock for accessing the cached files.
Definition duckdb.cpp:144678
◆ GetCachedFileInformation()
413381 {
413382 unique_lock<mutex> files_guard(
lock);
413383 vector<CachedFileInformation> result;
413385 auto ranges_guard = file.second->lock.GetSharedLock();
413386 for (const auto &range_entry : file.second->Ranges(ranges_guard)) {
413387 const auto &range = *range_entry.second;
413388 result.push_back(
413389 {file.first, range.nr_bytes, range.location, !range.block_handle->GetMemory().IsUnloaded()});
413390 }
413391 }
413392 return result;
413393}
◆ GetBufferManager()
| BufferManager & duckdb::ExternalFileCache::GetBufferManager |
( |
| ) |
const |
◆ GetOrCreateCachedFile()
Gets the cached file, or creates it if is not yet present.
413407 {
413408 lock_guard<mutex> guard(
lock);
413410 if (!entry) {
413411 entry = make_uniq<CachedFile>(path);
413412 }
413413 return *entry;
413414}
◆ IsValid()
| bool duckdb::ExternalFileCache::IsValid |
( |
bool | validate, |
|
|
const string & | cached_version_tag, |
|
|
timestamp_t | cached_last_modified, |
|
|
const string & | current_version_tag, |
|
|
timestamp_t | current_last_modified ) |
|
static |
413310 {
413311 if (!validate) {
413312 return true;
413313 }
413314 if (!current_version_tag.empty() || !cached_version_tag.empty()) {
413315 return cached_version_tag == current_version_tag;
413316 }
413317 if (cached_last_modified != current_last_modified) {
413318 return false;
413319 }
413320
413321
413322
413323 static constexpr int64_t LAST_MODIFIED_THRESHOLD = 10LL * 1000LL * 1000LL;
413325 if (access_time < current_last_modified) {
413326 return false;
413327 }
413328 return access_time - current_last_modified > LAST_MODIFIED_THRESHOLD;
413329}
static DUCKDB_API timestamp_t GetCurrentTimestamp()
Returns current timestamp.
Definition duckdb.cpp:129836
The documentation for this class was generated from the following file: