From f1fb1dd1965c78d79c585a81ef240381947881e9 Mon Sep 17 00:00:00 2001 From: Max Countryman Date: Mon, 22 Jan 2024 13:22:42 -0800 Subject: [PATCH] ignore external stores for now --- src/lib.rs | 4 ++-- tower-sessions-core/Cargo.toml | 8 +++++++- tower-sessions-core/src/session_store.rs | 18 ++++++++---------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f3a6637..449abe9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -99,7 +99,7 @@ //! which is designed to be executed as a recurring task. This process ensures //! the removal of expired sessions, maintaining your application's data //! integrity and performance. -//! ```rust,no_run +//! ```rust,no_run,ignore //! # use tower_sessions::{session_store::ExpiredDeletion}; //! # use tower_sessions_sqlx_store::{sqlx::SqlitePool, SqliteStore}; //! # tokio_test::block_on(async { @@ -280,7 +280,7 @@ //! To illustrate, this is how we might use the //! `MokaStore` as a frontend cache to a //! `PostgresStore` backend. -//! ```rust,no_run +//! ```rust,no_run,ignore //! # use tower::ServiceBuilder; //! # use tower_sessions::{CachingSessionStore, SessionManagerLayer}; //! # use tower_sessions_sqlx_store::{sqlx::PgPool, PostgresStore}; diff --git a/tower-sessions-core/Cargo.toml b/tower-sessions-core/Cargo.toml index fc3562b..4775cc0 100644 --- a/tower-sessions-core/Cargo.toml +++ b/tower-sessions-core/Cargo.toml @@ -18,7 +18,7 @@ async-trait = "0.1.73" axum-core = { version = "0.4.0", optional = true } base64 = "0.21.7" futures = { version = "0.3.28", default-features = false, features = [ - "async-await", + "async-await", ] } http = "1.0" parking_lot = { version = "0.12.1", features = ["serde"] } @@ -35,4 +35,10 @@ tracing = { version = "0.1.40", features = ["log"] } [dev-dependencies] tower-sessions = { workspace = true } +tower-sessions-sqlx-store = { version = "0.9.2", features = [ + "postgres", + "sqlite", + "mysql", +] } +tower-sessions-moka-store = { version = "0.9.1" } tokio-test = "0.4.3" diff --git a/tower-sessions-core/src/session_store.rs b/tower-sessions-core/src/session_store.rs index 3306dee..1ec615f 100644 --- a/tower-sessions-core/src/session_store.rs +++ b/tower-sessions-core/src/session_store.rs @@ -87,17 +87,16 @@ pub trait SessionStore: Debug + Send + Sync + 'static { /// /// # Examples /// -/// ```rust -/// # #[cfg(all(feature = "moka_store", feature = "sqlite_store"))] -/// # { +/// ```rust,ignore /// # tokio_test::block_on(async { -/// use tower_sessions::{CachingSessionStore, MokaStore, SqlitePool, SqliteStore}; -/// let pool = SqlitePool::connect("sqlite::memory:").await?; +/// use tower_sessions::CachingSessionStore; +/// use tower_sessions_moka_store::MokaStore; +/// use tower_sessions_sqlx_store::{SqlitePool, SqliteStore}; +/// let pool = SqlitePool::connect("sqlite::memory:").await.unwrap(); /// let sqlite_store = SqliteStore::new(pool); /// let moka_store = MokaStore::new(Some(2_000)); /// let caching_store = CachingSessionStore::new(moka_store, sqlite_store); /// # }) -/// # } /// ``` #[derive(Debug, Clone)] pub struct CachingSessionStore { @@ -183,10 +182,10 @@ where /// /// # Examples /// - /// ```rust,no_run - /// use tower_sessions::{session_store::ExpiredDeletion, sqlx::SqlitePool, SqliteStore}; + /// ```rust,no_run,ignore + /// use tower_sessions::session_store::ExpiredDeletion; + /// use tower_sessions_sqlx_store::{sqlx::SqlitePool, SqliteStore}; /// - /// # #[cfg(all(feature = "sqlite-store", feature = "deletion-task"))] /// # { /// # tokio_test::block_on(async { /// let pool = SqlitePool::connect("sqlite::memory:").await.unwrap(); @@ -198,7 +197,6 @@ where /// .continuously_delete_expired(tokio::time::Duration::from_secs(60)), /// ); /// # }) - /// # } /// ``` #[cfg(feature = "deletion-task")] #[cfg_attr(docsrs, doc(cfg(feature = "deletion-task")))]