Skip to main content

DistributedSessionStore

Trait DistributedSessionStore 

Source
pub trait DistributedSessionStore: Send + Sync {
    // Required method
    fn total_session_count<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Abstraction over a distributed session backend.

Implement this trait to integrate with Redis Cluster, Valkey, Hazelcast, or any other distributed key–value store that tracks session state.

Required Methods§

Source

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

Return the total number of active sessions across all nodes, including the current one.

The caller subtracts the local session count to arrive at the remote estimate; returning 0 from the default LocalOnlySessionStore therefore means “no remote sessions”.

Implementors§