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

Method Touch

src/CacheMemory.cpp:198–221  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

196
197// Move frame to front of queue (so it lasts longer)
198void CacheMemory::Touch(int64_t frame_number)
199{
200 // Create a scoped lock, to protect the cache from multiple threads
201 const std::lock_guard<std::recursive_mutex> lock(*cacheMutex);
202
203 // Does frame exists in cache?
204 if (frames.count(frame_number))
205 {
206 // Loop through frame numbers
207 std::deque<int64_t>::iterator itr;
208 for(itr = frame_numbers.begin(); itr != frame_numbers.end(); ++itr)
209 {
210 if (*itr == frame_number)
211 {
212 // erase frame number
213 frame_numbers.erase(itr);
214
215 // add frame number to 'front' of queue
216 frame_numbers.push_front(frame_number);
217 break;
218 }
219 }
220 }
221}
222
223// Clear the cache of all frames
224void CacheMemory::Clear()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected