Cache-first object fetching (#76)

* fix: submillisecond cache hits

* fix: async object loading to hand control back to renderer

* fix: clippy
This commit is contained in:
DecDuck
2025-07-27 12:04:50 +10:00
committed by GitHub
parent 682c6e9c0b
commit 739e6166c5
12 changed files with 110 additions and 101 deletions

View File

@ -113,7 +113,7 @@ pub fn fetch_library_logic(
}
// We should always have a cache of the object
// Pass db_handle because otherwise we get a gridlock
let game = get_cached_object_db::<String, Game>(meta.id.clone(), &db_handle)?;
let game = get_cached_object_db::<Game>(&meta.id.clone(), &db_handle)?;
games.push(game);
}
@ -173,7 +173,7 @@ pub fn fetch_game_logic(
version,
};
cache_object(id, game)?;
cache_object(&id, game)?;
return Ok(data);
}
@ -212,7 +212,7 @@ pub fn fetch_game_logic(
version,
};
cache_object(id, &game)?;
cache_object(&id, &game)?;
Ok(data)
}
@ -239,7 +239,7 @@ pub fn fetch_game_logic_offline(
drop(handle);
let status = GameStatusManager::fetch_state(&id);
let game = get_cached_object::<String, Game>(id)?;
let game = get_cached_object::<Game>(&id)?;
Ok(FetchGameStruct {
game,