Optimize OpenHome queue operations with caching

This commit introduces caching mechanisms for track IDs in OpenHome queues to reduce redundant SOAP calls. It adds a new `CurrentTrackIdCache` struct and integrates it into `OpenHomeQueue` to cache current track information with a 250ms TTL. The `queue_snapshot` method now uses cached track IDs instead of calling `read_all_tracks()` directly, and batched metadata reads are implemented. Cache invalidation is properly handled on write operations like `seek_id`, `stop`, `delete_all`, and `clear_queue`. The `read_all_tracks` function was removed from `openhome_client.rs` as it's now superseded by the caching logic. Additionally, the `Clone` derive was removed from `InternalQueue` and `MusicQueue` structs, and `trace` was added to the tracing imports in `openhome.rs`.
This commit is contained in:
2026-01-31 17:21:18 +01:00
parent 2b6462fdd9
commit 38bd063109
4 changed files with 113 additions and 58 deletions

View File

@@ -29,7 +29,7 @@ use crate::{
///
/// It does not talk to any remote service. All operations are pure
/// structural mutations on in-memory data.
#[derive(Clone, Debug)]
#[derive(Debug)]
pub struct InternalQueue {
renderer_id: DeviceId,
items: Vec<PlaybackItem>,