| 259 | } |
| 260 | |
| 261 | void 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}}} |