Skip to main content

InMemorySessionRepository

Type Alias InMemorySessionRepository 

Source
pub type InMemorySessionRepository<Session> = RwLock<HashMap<Endpoint, Session>>;
Expand description

An in-memory session repository implementation that stores sessions in a HashMap protected by an RwLock. This is a simple implementation that can be used for testing or in scenarios where persistence is not required.

Aliased Type§

pub struct InMemorySessionRepository<Session> { /* private fields */ }

Trait Implementations§

Source§

impl<Session> SessionRepository<Session> for InMemorySessionRepository<Session>
where Session: Clone + Send + Sync + 'static,

Source§

type GetError = ()

Source§

type SaveError = ()

Source§

type RemoveError = ()

Source§

async fn get(&self, destination: Endpoint) -> Result<Option<Session>, ()>

Source§

async fn save(&self, destination: Endpoint, session: Session) -> Result<(), ()>

Source§

async fn remove(&self, destination: Endpoint) -> Result<(), ()>