| 118 | // ================= InMemoryPersistentCache ================== |
| 119 | using Blob = PersistentCache::Blob; |
| 120 | Maybe<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 | |
| 141 | void InMemoryPersistentCache::put( |
| 142 | const std::string& category, const Blob& key, const Blob& value) { |
no test coverage detected