fix bug for local_cache

This commit is contained in:
KinderRiven 2022-04-28 17:11:25 +08:00
parent 641a5f5e35
commit 1fbaddf559

View File

@ -78,12 +78,15 @@ LRUFileCache::LRUFileCache(const String & cache_base_path_, const FileCacheSetti
void LRUFileCache::initialize()
{
if (fs::exists(cache_base_path))
loadCacheInfoIntoMemory();
else
fs::create_directories(cache_base_path);
is_initialized = true;
std::lock_guard cache_lock(mutex);
if (!is_initialized)
{
if (fs::exists(cache_base_path))
loadCacheInfoIntoMemory();
else
fs::create_directories(cache_base_path);
is_initialized = true;
}
}
void LRUFileCache::useCell(
@ -624,8 +627,6 @@ void LRUFileCache::remove(
void LRUFileCache::loadCacheInfoIntoMemory()
{
std::lock_guard cache_lock(mutex);
Key key;
UInt64 offset = 0;
size_t size = 0;