Clean up cached frames that exceed the number in our max_bytes variable
| 395 | |
| 396 | // Clean up cached frames that exceed the number in our max_bytes variable |
| 397 | void CacheDisk::CleanUp() |
| 398 | { |
| 399 | // Do we auto clean up? |
| 400 | if (max_bytes > 0) |
| 401 | { |
| 402 | // Create a scoped lock, to protect the cache from multiple threads |
| 403 | const std::lock_guard<std::recursive_mutex> lock(*cacheMutex); |
| 404 | |
| 405 | while (GetBytes() > max_bytes && frame_numbers.size() > 20) |
| 406 | { |
| 407 | // Get the oldest frame number. |
| 408 | int64_t frame_to_remove = frame_numbers.back(); |
| 409 | |
| 410 | // Remove frame_number and frame |
| 411 | Remove(frame_to_remove); |
| 412 | } |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | // Generate JSON string of this object |
| 417 | std::string CacheDisk::Json() { |
nothing calls this directly
no outgoing calls
no test coverage detected