pub struct InvalidationEvent {
pub event_type: InvalidationEventType,
pub entity: String,
pub record_id: Option<String>,
pub timestamp: Instant,
pub tags: Vec<EntityTag>,
pub metadata: Option<String>,
}Expand description
An event that triggers cache invalidation.
Fields§
§event_type: InvalidationEventTypeType of event.
entity: StringEntity affected.
record_id: Option<String>Record ID if applicable.
timestamp: InstantWhen the event occurred.
Tags to invalidate.
metadata: Option<String>Additional metadata.
Implementations§
Source§impl InvalidationEvent
impl InvalidationEvent
Sourcepub fn new(event_type: InvalidationEventType, entity: impl Into<String>) -> Self
pub fn new(event_type: InvalidationEventType, entity: impl Into<String>) -> Self
Create a new invalidation event.
Sourcepub fn with_record<I: Display>(self, id: I) -> Self
pub fn with_record<I: Display>(self, id: I) -> Self
Set the record ID.
Add multiple tags.
Sourcepub fn with_metadata(self, metadata: impl Into<String>) -> Self
pub fn with_metadata(self, metadata: impl Into<String>) -> Self
Set metadata.
Get all tags that should be invalidated.
Trait Implementations§
Source§impl Clone for InvalidationEvent
impl Clone for InvalidationEvent
Source§fn clone(&self) -> InvalidationEvent
fn clone(&self) -> InvalidationEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for InvalidationEvent
impl RefUnwindSafe for InvalidationEvent
impl Send for InvalidationEvent
impl Sync for InvalidationEvent
impl Unpin for InvalidationEvent
impl UnwindSafe for InvalidationEvent
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