Expand description
§async-sqlx-session
This crate currently provides several session stores, each of which is enabled by a feature flag.
- To use
SqliteSessionStore
, enable thesqlite
feature on this crate. - To use
PostgresSessionStore
, enable thepg
feature on this crate. - To use [
MysqlSessionStore
], enable themysql
feature on this crate.
To use the spawn_cleanup_task
function for either store on
async-std, enable the async_std
feature. To perform session cleanup
intermittently with a different runtime, use a function like:
ⓘ
fn clean_up_intermittently(store: &SqliteSessionStore, period: Duration) {
let store = store.clone();
other_runtime::spawn(async move {
loop {
other_runtime::sleep(period).await;
if let Err(error) = store.cleanup().await {
log::error!("cleanup error: {}", error);
}
}
});
}
Structs§
- MySql
Session Store - sqlx mysql session store for async-sessions
- Postgres
Session Store - sqlx postgres session store for async-sessions
- Sqlite
Session Store - sqlx sqlite session store for async-sessions