| 237 | } |
| 238 | |
| 239 | Maybe<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 | |
| 261 | void InFilePersistentCache::put( |
| 262 | const std::string& category, const Blob& key, const Blob& value) { |
no test coverage detected