|
1 |
| -//! # async-sqlx-session |
2 |
| -//! |
3 |
| -//! This crate currently provides two session stores: [`PostgresSessionStore`] and [`SqliteSessionStore`], each of which is enabled by a feature flag. |
4 |
| -//! To use `SqliteSessionStore`, enable the `sqlite` feature on this crate. |
5 |
| -//! To use `PostgresSessionStore`, enable the `pg` feature on this crate. |
| 1 | +/*! |
| 2 | +# async-sqlx-session |
| 3 | +
|
| 4 | +This crate currently provides two session stores: |
| 5 | +[`PostgresSessionStore`] and [`SqliteSessionStore`], each of which |
| 6 | +is enabled by a feature flag. |
| 7 | +
|
| 8 | +To use [`SqliteSessionStore`], enable the `sqlite` feature on this |
| 9 | +crate. |
| 10 | +
|
| 11 | +To use [`PostgresSessionStore`], enable the `pg` feature on this |
| 12 | +crate. |
| 13 | +
|
| 14 | +To use the `spawn_cleanup_task` function for either store on |
| 15 | +async-std, enable the `async_std` feature. To perform session cleanup |
| 16 | +intermittently with a different runtime, use a function like: |
| 17 | +
|
| 18 | +```rust,ignore |
| 19 | +fn clean_up_intermittently(store: &SqliteSessionStore, period: Duration) { |
| 20 | + let store = store.clone(); |
| 21 | + other_runtime::spawn(async move { |
| 22 | + loop { |
| 23 | + other_runtime::sleep(period).await; |
| 24 | + if let Err(error) = store.cleanup().await { |
| 25 | + log::error!("cleanup error: {}", error); |
| 26 | + } |
| 27 | + } |
| 28 | + }); |
| 29 | +} |
| 30 | +``` |
| 31 | +*/ |
| 32 | + |
6 | 33 | #![forbid(unsafe_code, future_incompatible)]
|
7 | 34 | #![deny(
|
8 | 35 | missing_debug_implementations,
|
|
0 commit comments