pub struct TicketCache { /* private fields */ }Expand description
Thread-safe in-memory cache for tickets
Implementations§
Source§impl TicketCache
impl TicketCache
Sourcepub fn with_default_ttl() -> Self
pub fn with_default_ttl() -> Self
Creates a new cache with a default TTL of 5 minutes
Sourcepub fn get_ticket(&self, id: &TicketId) -> Option<Ticket>
pub fn get_ticket(&self, id: &TicketId) -> Option<Ticket>
Gets a single ticket from cache
Sourcepub fn cache_ticket(&self, ticket: &Ticket)
pub fn cache_ticket(&self, ticket: &Ticket)
Caches a single ticket
Sourcepub fn get_all_tickets(&self) -> Option<Vec<Ticket>>
pub fn get_all_tickets(&self) -> Option<Vec<Ticket>>
Gets all tickets from cache
Sourcepub fn cache_all_tickets(&self, tickets: &[Ticket])
pub fn cache_all_tickets(&self, tickets: &[Ticket])
Caches all tickets
Sourcepub fn invalidate_ticket(&self, id: &TicketId)
pub fn invalidate_ticket(&self, id: &TicketId)
Invalidates a specific ticket in the cache
Sourcepub fn invalidate_all(&self)
pub fn invalidate_all(&self)
Invalidates all cached data
Sourcepub fn cleanup_expired(&self)
pub fn cleanup_expired(&self)
Removes expired entries from the cache
Auto Trait Implementations§
impl Freeze for TicketCache
impl RefUnwindSafe for TicketCache
impl Send for TicketCache
impl Sync for TicketCache
impl Unpin for TicketCache
impl UnsafeUnpin for TicketCache
impl UnwindSafe for TicketCache
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