Skip to main content

read_cached_session

Function read_cached_session 

Source
pub fn read_cached_session(cache: &SessionCache, id: &str) -> Option<Session>
Expand description

Read a session out of the in-memory cache, cloning it out from under the brief sync read-lock. Returns None on a cache miss.

This is the single canonical cache-read used everywhere a caller holds a SessionCache (HTTP handlers, server tools, the app-state loader). It replaced ~13 verbatim copies of the cache.get(id).map(|e| e.value().clone()).map(|a| a.read().clone()) idiom.