MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / CleanUp

Method CleanUp

src/CacheDisk.cpp:397–414  ·  view source on GitHub ↗

Clean up cached frames that exceed the number in our max_bytes variable

Source from the content-addressed store, hash-verified

395
396// Clean up cached frames that exceed the number in our max_bytes variable
397void 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
417std::string CacheDisk::Json() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected