pub struct SqliteSessionStore { /* private fields */ }Expand description
Session store backed by SQLite with connection pooling. Uses r2d2 for concurrent reads and spawn_blocking to avoid blocking the async runtime.
Implementations§
Source§impl SqliteSessionStore
impl SqliteSessionStore
Sourcepub fn new(db_path: impl AsRef<Path>, max_age_seconds: i64) -> Result<Self>
pub fn new(db_path: impl AsRef<Path>, max_age_seconds: i64) -> Result<Self>
Create a new session store with SQLite database. Uses a connection pool (max 4 connections) with WAL mode.
Sourcepub fn in_memory(max_age_seconds: i64) -> Result<Self>
pub fn in_memory(max_age_seconds: i64) -> Result<Self>
Create a new in-memory session store (for testing). Uses max_size=1 because in-memory DBs are per-connection.
Sourcepub async fn update(&self, id: &str, data: HashMap<String, Value>) -> Result<()>
pub async fn update(&self, id: &str, data: HashMap<String, Value>) -> Result<()>
Update session data
Sourcepub async fn cleanup_expired(&self) -> Result<u64>
pub async fn cleanup_expired(&self) -> Result<u64>
Clean up expired sessions
Sourcepub async fn list_session_ids(&self) -> Result<Vec<String>>
pub async fn list_session_ids(&self) -> Result<Vec<String>>
List all active (non-expired) session IDs
Sourcepub async fn apply_atomic_mutation(
&self,
id: &str,
mutation: &AtomicMutation,
) -> Result<HashMap<String, Value>>
pub async fn apply_atomic_mutation( &self, id: &str, mutation: &AtomicMutation, ) -> Result<HashMap<String, Value>>
Apply a single atomic mutation directly in SQL using json_set/json_extract. Returns the updated session data after the mutation.
Trait Implementations§
Source§impl Clone for SqliteSessionStore
impl Clone for SqliteSessionStore
Source§fn clone(&self) -> SqliteSessionStore
fn clone(&self) -> SqliteSessionStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SqliteSessionStore
impl !UnwindSafe for SqliteSessionStore
impl Freeze for SqliteSessionStore
impl Send for SqliteSessionStore
impl Sync for SqliteSessionStore
impl Unpin for SqliteSessionStore
impl UnsafeUnpin for SqliteSessionStore
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more