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:
@@ -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>,
|
||||
|
||||
Reference in New Issue
Block a user