| 175 | } |
| 176 | |
| 177 | void KeyCache::ClearInternal(bool disable) |
| 178 | { |
| 179 | lock_guard<mutex> lock(m_mutex); |
| 180 | |
| 181 | if (m_valid_count > 0) { |
| 182 | |
| 183 | for (auto& it : m_entries) { |
| 184 | if (it.second.valid && (disable || !it.second.accessed)) { |
| 185 | #ifdef _DEBUG |
| 186 | //char buf[64]; |
| 187 | //sprintf_s(buf, "clearing keys for cache id %llu\n", it.first); |
| 188 | //OutputDebugStringA(buf); |
| 189 | #endif |
| 190 | it.second.Clear(); |
| 191 | m_valid_count--; |
| 192 | } else { |
| 193 | it.second.accessed = false; |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | if (disable) { |
| 199 | #ifdef _DEBUG |
| 200 | string mes = "disabling key cache at " + get_local_time_string() + "\n"; |
| 201 | OutputDebugStringA(mes.c_str()); |
| 202 | #endif |
| 203 | m_enabled = false; |
| 204 | assert(m_valid_count == 0); |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | bool KeyCache::Store(id_t id, const BYTE* ptr, size_t len) |
| 209 | { |
nothing calls this directly
no test coverage detected