pub struct StreamCache {
pub hits: u64,
pub misses: u64,
/* private fields */
}Expand description
Stream-aware cache for inference pipelines.
Key insight: during inference, the filter STATE is fixed (from training). Only the DATA changes. So we cache:
- Filter states (from training) — keyed by config_hash + training_data_hash
- Chunk results — keyed by config_hash + state_hash + chunk_hash
This means: if the same chunk passes through the same filter with the same trained state, the result is returned from cache instantly.
Fields§
§hits: u64Stats
misses: u64Implementations§
Source§impl StreamCache
impl StreamCache
pub fn new(max_chunks: usize) -> Self
Sourcepub fn load_state(&mut self, filter_id: &str, state_key: CacheKey, state: Value)
pub fn load_state(&mut self, filter_id: &str, state_key: CacheKey, state: Value)
Load a filter’s trained state into the stream cache.
Sourcepub fn get_state(&self, filter_id: &str) -> Option<&Value>
pub fn get_state(&self, filter_id: &str) -> Option<&Value>
Get a filter’s cached state (for forward() during inference).
Auto Trait Implementations§
impl Freeze for StreamCache
impl RefUnwindSafe for StreamCache
impl Send for StreamCache
impl Sync for StreamCache
impl Unpin for StreamCache
impl UnsafeUnpin for StreamCache
impl UnwindSafe for StreamCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more