| 781 | } |
| 782 | |
| 783 | void DBClient::sync(bool clearCache) |
| 784 | { |
| 785 | for (auto &[hashKey, entryCache] : dbCache) { |
| 786 | if (entryCache.dirty) { |
| 787 | storage.set(entryCache.key, entryCache.record, mask); |
| 788 | entryCache.dirty = false; |
| 789 | } |
| 790 | } |
| 791 | |
| 792 | if (clearCache) { |
| 793 | // Clear all cache as records in dbStorage might be newer |
| 794 | dbCache.clear(); |
| 795 | dbRecordCache.clear(); |
| 796 | } |
| 797 | } |
| 798 | |
| 799 | } // namespace Database |
no test coverage detected