static */
| 1303 | } |
| 1304 | |
| 1305 | /* static */ BlockCache::EntryDesc* BlockCache::writeEntryDescAndKey( |
| 1306 | MutableBufferView buffer, |
| 1307 | const HashedKey& hk, |
| 1308 | uint32_t valueSize, |
| 1309 | uint32_t lastAccessTimeSecs) { |
| 1310 | // Copy descriptor and the key to the end |
| 1311 | const auto& key = hk.key(); |
| 1312 | uint8_t* dest = buffer.data() + buffer.size() - sizeof(EntryDesc); |
| 1313 | auto desc = new (dest) |
| 1314 | EntryDesc(static_cast<uint32_t>(key.size()), valueSize, hk.keyHash(), |
| 1315 | lastAccessTimeSecs); // desc |
| 1316 | std::memcpy(dest - key.size(), key.data(), key.size()); // key |
| 1317 | return desc; |
| 1318 | } |
| 1319 | |
| 1320 | void BlockCache::writeEntry(MutableBufferView buffer, |
| 1321 | std::optional<HashedKey> hk, |