pub struct InvalidationManager { /* private fields */ }Expand description
Cache invalidation manager
Tracks table -> cache key mappings and handles invalidation events.
Implementations§
Source§impl InvalidationManager
impl InvalidationManager
Sourcepub fn new(config: InvalidationConfig) -> Self
pub fn new(config: InvalidationConfig) -> Self
Create a new invalidation manager
Sourcepub fn register(&self, key: &CacheKey, table: &str)
pub fn register(&self, key: &CacheKey, table: &str)
Register a cache key for table-based invalidation
Sourcepub fn unregister(&self, key: &CacheKey)
pub fn unregister(&self, key: &CacheKey)
Unregister a cache key
Sourcepub fn get_keys_for_table(&self, table: &str) -> Vec<CacheKey>
pub fn get_keys_for_table(&self, table: &str) -> Vec<CacheKey>
Get all cache keys associated with a table
Sourcepub fn get_tables_for_key(&self, key: &CacheKey) -> Vec<String>
pub fn get_tables_for_key(&self, key: &CacheKey) -> Vec<String>
Get all tables associated with a cache key
Sourcepub fn invalidate_table(&self, table: &str)
pub fn invalidate_table(&self, table: &str)
Invalidate all cache entries for a table
Sourcepub fn invalidate_tables(&self, tables: &[String])
pub fn invalidate_tables(&self, tables: &[String])
Invalidate multiple tables
Sourcepub fn queue_invalidation(&self, table: &str)
pub fn queue_invalidation(&self, table: &str)
Queue a table for batched invalidation
Sourcepub fn flush_pending(&self)
pub fn flush_pending(&self)
Flush pending invalidations
Sourcepub fn on_wal_event(&self, table: &str, operation: WalOperation, lsn: u64)
pub fn on_wal_event(&self, table: &str, operation: WalOperation, lsn: u64)
Handle a WAL event
Sourcepub fn subscribe(&self) -> Receiver<InvalidationEvent>
pub fn subscribe(&self) -> Receiver<InvalidationEvent>
Subscribe to invalidation events
Sourcepub fn is_wal_connected(&self) -> bool
pub fn is_wal_connected(&self) -> bool
Check if WAL is connected
Sourcepub fn set_wal_connected(&self, connected: bool)
pub fn set_wal_connected(&self, connected: bool)
Set WAL connection status
Sourcepub fn mode(&self) -> InvalidationMode
pub fn mode(&self) -> InvalidationMode
Get invalidation mode
Sourcepub fn last_invalidation_time(&self, table: &str) -> Option<Instant>
pub fn last_invalidation_time(&self, table: &str) -> Option<Instant>
Get last invalidation time for a table
Sourcepub fn stats(&self) -> InvalidationStats
pub fn stats(&self) -> InvalidationStats
Get statistics
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for InvalidationManager
impl !RefUnwindSafe for InvalidationManager
impl Send for InvalidationManager
impl Sync for InvalidationManager
impl Unpin for InvalidationManager
impl UnsafeUnpin for InvalidationManager
impl !UnwindSafe for InvalidationManager
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more