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

Method Touch

src/CacheDisk.cpp:338–361  ·  view source on GitHub ↗

Move frame to front of queue (so it lasts longer)

Source from the content-addressed store, hash-verified

336
337// Move frame to front of queue (so it lasts longer)
338void CacheDisk::Touch(int64_t frame_number)
339{
340 // Does frame exists in cache?
341 if (frames.count(frame_number))
342 {
343 // Create a scoped lock, to protect the cache from multiple threads
344 const std::lock_guard<std::recursive_mutex> lock(*cacheMutex);
345
346 // Loop through frame numbers
347 std::deque<int64_t>::iterator itr;
348 for(itr = frame_numbers.begin(); itr != frame_numbers.end(); ++itr)
349 {
350 if (*itr == frame_number)
351 {
352 // erase frame number
353 frame_numbers.erase(itr);
354
355 // add frame number to 'front' of queue
356 frame_numbers.push_front(frame_number);
357 break;
358 }
359 }
360 }
361}
362
363// Clear the cache of all frames
364void CacheDisk::Clear()

Callers 2

prefetchWindowMethod · 0.45
runMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected