feat: add redis, mongodb and sqlx session stores#68
Closed
chrislearn wants to merge 4 commits intohttp-rs:mainfrom
Closed
feat: add redis, mongodb and sqlx session stores#68chrislearn wants to merge 4 commits intohttp-rs:mainfrom
chrislearn wants to merge 4 commits intohttp-rs:mainfrom
Conversation
- Use tokio for test and doc - Use postcard for bincode is deprecated.
Adds three new pluggable session stores behind cargo features: - `redis` → `RedisStore` (uses ConnectionManager for connection reuse) - `mongodb` → `MongoDbStore` (TTL index via `initialize()`) - `sqlx` + `sqlx-postgres` / `sqlx-sqlite` / `sqlx-mysql` → `SqlxPostgresStore` / `SqlxSqliteStore` / `SqlxMySqlStore`, all using `sqlx::Pool` for connection pooling Includes ignored integration tests for every backend and bilingual (en/zh) usage docs under `docs/`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Opened against the wrong repo by mistake — re-creating against salvo-rs/saysion. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
redis,mongodb, andsqlx(with sub-featuressqlx-postgres/sqlx-sqlite/sqlx-mysql).sqlx::Poolfor connection pooling;RedisStoreusesConnectionManager;MongoDbStorerelies on the official driver's built-in pool.docs/and ignored integration tests for every backend.Stores
RedisStoreredisSET ... EX, configurable key prefixMongoDbStoremongodbinitialize()creates a TTL index onexpires_atSqlxPostgresStoresqlx-postgresmigrate()/cleanup()helpersSqlxSqliteStoresqlx-sqliteSqlxMySqlStoresqlx-mysqlSQLx stores share a portable schema (
expiresstored asBIGINTunix seconds) so no extra sqlx type-conversion features are required.Test plan
cargo check --features rediscargo check --features mongodbcargo check --features sqlx-postgres,sqlx-sqlite,sqlx-mysqlcargo test --features redis,mongodb,sqlx-postgres,sqlx-sqlite,sqlx-mysql --no-rundocs/en/stores.mdfor commands)🤖 Generated with Claude Code