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

Method get

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

Source from the content-addressed store, hash-verified

237}
238
239Maybe<InFilePersistentCache::Blob> InFilePersistentCache::get(
240 const std::string& category, const Blob& key) {
241 decltype(m_cache.begin()) iter0;
242 {
243 MGB_LOCK_GUARD(m_mtx);
244 iter0 = m_cache.find(category);
245 if (iter0 == m_cache.end())
246 return None;
247 }
248
249 BlobStorage key_storage;
250 key_storage.Blob::operator=(key);
251 key_storage.init_hash();
252
253 MGB_LOCK_GUARD(m_mtx);
254
255 auto iter1 = iter0->second.find(key_storage);
256 if (iter1 == iter0->second.end())
257 return None;
258 return iter1->second;
259}
260
261void InFilePersistentCache::put(
262 const std::string& category, const Blob& key, const Blob& value) {

Callers 4

write_to_fileMethod · 0.45
dump_cacheMethod · 0.45
putMethod · 0.45

Calls 3

beginMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected