pub struct StickySession {
pub cookie_name: String,
pub backend_map: BTreeMap<String, usize>,
}Expand description
Sticky session manager (cookie-based affinity).
Fields§
Cookie name used for session affinity.
backend_map: BTreeMap<String, usize>Session ID -> backend index mapping.
Implementations§
Source§impl StickySession
impl StickySession
Sourcepub fn get_backend(&self, session_id: &str) -> Option<usize>
pub fn get_backend(&self, session_id: &str) -> Option<usize>
Get the backend index for a session.
Sourcepub fn set_backend(&mut self, session_id: String, backend_idx: usize)
pub fn set_backend(&mut self, session_id: String, backend_idx: usize)
Set the backend for a session.
Sourcepub fn remove_session(&mut self, session_id: &str)
pub fn remove_session(&mut self, session_id: &str)
Remove a session.
Sourcepub fn session_count(&self) -> usize
pub fn session_count(&self) -> usize
Get the number of active sessions.
Trait Implementations§
Source§impl Clone for StickySession
impl Clone for StickySession
Source§fn clone(&self) -> StickySession
fn clone(&self) -> StickySession
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StickySession
impl RefUnwindSafe for StickySession
impl Send for StickySession
impl Sync for StickySession
impl Unpin for StickySession
impl UnwindSafe for StickySession
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)