Trait fred::interfaces::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 = RedisResult<()>>
       where P: Into<MultipleStrings> { ... }
    fn stop_tracking(&self) -> impl Future<Output = RedisResult<()>> { ... }
    fn on_invalidation<F>(&self, func: F) -> JoinHandle<RedisResult<()>>
       where F: Fn(Invalidation) -> RedisResult<()> + '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 = RedisResult<()>>

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 = RedisResult<()>>

Disable client tracking on all connections.

source

fn on_invalidation<F>(&self, func: F) -> JoinHandle<RedisResult<()>>
where F: Fn(Invalidation) -> RedisResult<()> + '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).

Object Safety§

This trait is not object safe.

Implementors§