Clear the cache of all frames
| 362 | |
| 363 | // Clear the cache of all frames |
| 364 | void CacheDisk::Clear() |
| 365 | { |
| 366 | // Create a scoped lock, to protect the cache from multiple threads |
| 367 | const std::lock_guard<std::recursive_mutex> lock(*cacheMutex); |
| 368 | |
| 369 | // Clear all containers |
| 370 | frames.clear(); |
| 371 | frame_numbers.clear(); |
| 372 | frame_numbers.shrink_to_fit(); |
| 373 | ordered_frame_numbers.clear(); |
| 374 | ordered_frame_numbers.shrink_to_fit(); |
| 375 | needs_range_processing = true; |
| 376 | frame_size_bytes = 0; |
| 377 | |
| 378 | // Delete cache directory, and recreate it |
| 379 | QString current_path = path.path(); |
| 380 | path.removeRecursively(); |
| 381 | |
| 382 | // Re-init folder |
| 383 | InitPath(current_path.toStdString()); |
| 384 | } |
| 385 | |
| 386 | // Count the frames in the queue |
| 387 | int64_t CacheDisk::Count() |