Skip to main content

TrackingInterface

Trait TrackingInterface 

Source
pub trait TrackingInterface: ClientLike + Sized {
    // Provided methods
    fn start_tracking<P>(
        &self,
        prefixes: P,
        bcast: bool,
        optin: bool,
        optout: bool,
        noloop: bool,
    ) -> impl Future<Output = FredResult<()>> + Send
       where P: Into<MultipleStrings> + Send { ... }
    fn stop_tracking(&self) -> impl Future<Output = FredResult<()>> + Send { ... }
    fn on_invalidation<F>(&self, func: F) -> JoinHandle<FredResult<()>> ⓘ
       where F: Fn(Invalidation) -> FredResult<()> + Send + 'static { ... }
    fn invalidation_rx(&self) -> BroadcastReceiver<Invalidation> { ... }
}
Available on crate feature i-tracking only.
Expand description

A high level interface that supports client side caching via the client tracking interface.

Provided Methods§

Source

fn start_tracking<P>( &self, prefixes: P, bcast: bool, optin: bool, optout: bool, noloop: bool, ) -> impl Future<Output = FredResult<()>> + Send

Send the CLIENT TRACKING command to all connected servers, subscribing to invalidation messages on the same connection.

This interface requires the RESP3 protocol mode and supports all server deployment types (centralized, clustered, and sentinel).

See the basic client tracking function for more information on the underlying commands.

Source

fn stop_tracking(&self) -> impl Future<Output = FredResult<()>> + Send

Disable client tracking on all connections.

Source

fn on_invalidation<F>(&self, func: F) -> JoinHandle<FredResult<()>> ⓘ
where F: Fn(Invalidation) -> FredResult<()> + Send + 'static,

Spawn a task that processes invalidation messages from the server.

See invalidation_rx for a more flexible variation of this function.

Source

fn invalidation_rx(&self) -> BroadcastReceiver<Invalidation>

Subscribe to invalidation messages from the server(s).

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§