aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/cache/cachedisklayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenserver/cache/cachedisklayer.cpp')
-rw-r--r--src/zenserver/cache/cachedisklayer.cpp19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/zenserver/cache/cachedisklayer.cpp b/src/zenserver/cache/cachedisklayer.cpp
index f937f7d4d..a9ac46cab 100644
--- a/src/zenserver/cache/cachedisklayer.cpp
+++ b/src/zenserver/cache/cachedisklayer.cpp
@@ -2249,12 +2249,6 @@ ZenCacheDiskLayer::CacheBucket::PutInlineCacheValue(const IoHash& HashKey, const
EntryFlags |= DiskLocation::kCompressed;
}
- uint64_t PayloadSize = Value.Value.GetSize();
- const bool MemCacheEnabled = (m_Configuration.MemCacheSizeThreshold > 0);
- IoBuffer MemCacheBuffer = (MemCacheEnabled && (PayloadSize <= m_Configuration.MemCacheSizeThreshold))
- ? IoBufferBuilder::ReadFromFileMaybe(Value.Value)
- : IoBuffer{};
-
m_BlockStore.WriteChunk(Value.Value.Data(),
Value.Value.Size(),
m_Configuration.PayloadAlignment,
@@ -2263,14 +2257,14 @@ ZenCacheDiskLayer::CacheBucket::PutInlineCacheValue(const IoHash& HashKey, const
m_SlogFile.Append({.Key = HashKey, .Location = Location});
RwLock::ExclusiveLockScope IndexLock(m_IndexLock);
- PayloadIndex EntryIndex = {};
if (auto It = m_Index.find(HashKey); It != m_Index.end())
{
- EntryIndex = It.value();
+ PayloadIndex EntryIndex = It.value();
ZEN_ASSERT_SLOW(EntryIndex < PayloadIndex(m_AccessTimes.size()));
BucketPayload& Payload = m_Payloads[EntryIndex];
RemoveMemCachedData(Payload);
+ RemoveMetaData(Payload);
Payload = (BucketPayload{.Location = Location});
m_AccessTimes[EntryIndex] = GcClock::TickCount();
@@ -2282,7 +2276,7 @@ ZenCacheDiskLayer::CacheBucket::PutInlineCacheValue(const IoHash& HashKey, const
}
else
{
- EntryIndex = PayloadIndex(m_Payloads.size());
+ PayloadIndex EntryIndex = PayloadIndex(m_Payloads.size());
m_Payloads.emplace_back(BucketPayload{.Location = Location});
m_AccessTimes.emplace_back(GcClock::TickCount());
if (m_Configuration.EnableReferenceCaching)
@@ -2292,13 +2286,6 @@ ZenCacheDiskLayer::CacheBucket::PutInlineCacheValue(const IoHash& HashKey, const
}
m_Index.insert_or_assign(HashKey, EntryIndex);
}
-
- if (MemCacheBuffer)
- {
- BucketPayload& Payload = m_Payloads[EntryIndex];
- SetMemCachedData(Payload, MemCacheBuffer);
- }
- RemoveMetaData(m_Payloads[EntryIndex]);
});
}