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

Method get

src/core/impl/utils/persistent_cache.cpp:120–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118// ================= InMemoryPersistentCache ==================
119using Blob = PersistentCache::Blob;
120Maybe<Blob> InMemoryPersistentCache::get(const std::string& category, const Blob& key) {
121 decltype(m_cache.begin()) iter0;
122 {
123 MGB_LOCK_GUARD(m_mtx);
124 iter0 = m_cache.find(category);
125 if (iter0 == m_cache.end())
126 return None;
127 }
128
129 BlobStorage key_storage;
130 key_storage.Blob::operator=(key);
131 key_storage.init_hash();
132
133 MGB_LOCK_GUARD(m_mtx);
134
135 auto iter1 = iter0->second.find(key_storage);
136 if (iter1 == iter0->second.end())
137 return None;
138 return iter1->second;
139}
140
141void InMemoryPersistentCache::put(
142 const std::string& category, const Blob& key, const Blob& value) {

Callers 5

do_addMethod · 0.45
stats.cppFile · 0.45
print_nodeMethod · 0.45
allocMethod · 0.45

Calls 7

instFunction · 0.85
build_blobMethod · 0.80
resizeMethod · 0.80
beginMethod · 0.45
findMethod · 0.45
endMethod · 0.45
validMethod · 0.45

Tested by

no test coverage detected