SessionStore

Trait SessionStore 

Source
pub trait SessionStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn get(&self, key: &SessionKey) -> GResult<Option<(Session, Cas)>>;
    fn put(&self, session: Session) -> GResult<Cas>;
    fn update_cas(
        &self,
        session: Session,
        expected: Cas,
    ) -> GResult<Result<Cas, Cas>>;
    fn delete(&self, key: &SessionKey) -> GResult<bool>;
    fn touch(&self, key: &SessionKey, ttl_secs: Option<u32>) -> GResult<bool>;
}

Required Methods§

Source

fn get(&self, key: &SessionKey) -> GResult<Option<(Session, Cas)>>

Fetch by key; returns (Session, Cas) if present.

Source

fn put(&self, session: Session) -> GResult<Cas>

Create or replace, returning the new Cas.

Source

fn update_cas( &self, session: Session, expected: Cas, ) -> GResult<Result<Cas, Cas>>

Update using CAS—only writes if expected matches the stored Cas.

Source

fn delete(&self, key: &SessionKey) -> GResult<bool>

Delete by key; return true if something was deleted.

Source

fn touch(&self, key: &SessionKey, ttl_secs: Option<u32>) -> GResult<bool>

Refresh TTL or updated_at without modifying payload.

Implementors§