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

Method ClearAllCache

src/Timeline.cpp:1779–1816  ·  view source on GitHub ↗

Clear all caches

Source from the content-addressed store, hash-verified

1777
1778// Clear all caches
1779void Timeline::ClearAllCache(bool deep) {
1780 // Get lock (prevent getting frames while this happens)
1781 const std::lock_guard<std::recursive_mutex> guard(getFrameMutex);
1782
1783 // Clear primary cache
1784 if (final_cache) {
1785 final_cache->Clear();
1786 }
1787
1788 // Loop through all clips
1789 try {
1790 for (const auto clip : clips) {
1791 // Clear cache on clip and reader if present
1792 if (clip->Reader()) {
1793 if (auto rc = clip->Reader()->GetCache())
1794 rc->Clear();
1795
1796 // Clear nested Reader (if deep clear requested)
1797 if (deep && clip->Reader()->Name() == "FrameMapper") {
1798 FrameMapper *nested_reader = static_cast<FrameMapper *>(clip->Reader());
1799 if (nested_reader->Reader()) {
1800 if (auto nc = nested_reader->Reader()->GetCache())
1801 nc->Clear();
1802 }
1803 }
1804 }
1805
1806 // Clear clip cache
1807 if (auto cc = clip->GetCache())
1808 cc->Clear();
1809 }
1810 } catch (const ReaderClosed & e) {
1811 // ...
1812 }
1813
1814 // Cache content changed: notify cache clients to rebuild their window baseline.
1815 BumpCacheEpoch();
1816}
1817
1818// Set Max Image Size (used for performance optimization). Convenience function for setting
1819// Settings::Instance()->MAX_WIDTH and Settings::Instance()->MAX_HEIGHT.

Callers 5

SeekMethod · 0.80
clearCacheIfPausedMethod · 0.80
runMethod · 0.80
Clip.cppFile · 0.80
Timeline.cppFile · 0.80

Calls 4

ClearMethod · 0.45
ReaderMethod · 0.45
GetCacheMethod · 0.45
NameMethod · 0.45

Tested by

no test coverage detected