MCPcopy Create free account
hub / github.com/OpenBoard-org/OpenBoard / insertEntry

Method insertEntry

src/core/UBSceneCache.cpp:275–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275void UBSceneCache::insertEntry(UBSceneCacheID key, std::shared_ptr<SceneCacheEntry> entry)
276{
277 mSceneCache.insert(key, entry);
278 mCachedKeyFIFO.removeAll(key);
279 mCachedKeyFIFO.enqueue(key);
280
281 // remove LRU entries if cache size grows beyond limit
282 auto entries = mCachedKeyFIFO.size();
283
284 while (entries-- > UBSettings::settings()->pageCacheSize->get().toInt())
285 {
286 qDebug() << "cache full, size" << entries;
287 const auto key = mCachedKeyFIFO.dequeue();
288 auto entry = mSceneCache.value(key);
289
290 // remove if still loading or inactive
291 if ((entry->isSceneAvailable() && !entry->scene()->isActive())
292 || !entry->isSceneAvailable())
293 {
294 qDebug() << "removing page" << key.pageIndex << "of" << key.documentProxy->documentFolderName();
295 removeScene(key.documentProxy, key.pageIndex);
296 entry = nullptr;
297 qDebug() << "removed page" << key.pageIndex << "of" << key.documentProxy->documentFolderName();
298 break;
299 }
300 }
301}
302
303UBSceneCache::SceneCacheEntry::SceneCacheEntry(std::shared_ptr<UBDocumentProxy> proxy, int pageIndex)
304{

Callers

nothing calls this directly

Calls 7

isSceneAvailableMethod · 0.80
documentFolderNameMethod · 0.80
insertMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
valueMethod · 0.45
sceneMethod · 0.45

Tested by

no test coverage detected