MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / put

Method put

src/core/impl/utils/infile_persistent_cache.cpp:261–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261void InFilePersistentCache::put(
262 const std::string& category, const Blob& key, const Blob& value) {
263 BlobStorage key_storage;
264 key_storage.init_data_ref(key).init_hash();
265
266 MGB_LOCK_GUARD(m_mtx);
267 auto size0 = m_cache.size();
268 m_cache[category][std::move(key_storage)].init_data_ref(value);
269 if (m_cache.size() > size0) {
270 mgb_log_debug("new cache category: %s", category.c_str());
271 }
272 if (m_always_open_file) {
273 m_always_open_file->set_head();
274 dump_cache(m_always_open_file.get());
275 m_always_open_file->flush();
276 }
277}
278
279// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}

Callers

nothing calls this directly

Calls 4

set_headMethod · 0.80
sizeMethod · 0.45
getMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected