Skip to main content

CacheInvalidationBus

Trait CacheInvalidationBus 

Source
pub trait CacheInvalidationBus:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn publish<'life0, 'async_trait>(
        &'life0 self,
        message: CacheInvalidationMessage,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe(&self) -> Box<dyn CacheInvalidationReceiver>;
}
Expand description

Transport abstraction for cross-cache invalidation.

Implement this trait for a real transport such as Postgres LISTEN/NOTIFY, Redis Pub/Sub, NATS, or an application-specific message bus. HydraCache only requires fire-and-forget invalidation messages; values are never replicated.

Required Methods§

Source

fn publish<'life0, 'async_trait>( &'life0 self, message: CacheInvalidationMessage, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Publish an invalidation message.

Source

fn subscribe(&self) -> Box<dyn CacheInvalidationReceiver>

Subscribe to invalidation messages.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§