-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot retrieve records in handlers #3
Comments
Hi there, have you had a look at the Crate docs already? This example in particular might be helpful. There isn't an example of Redis specifically, however I'd be happy to accept a PR with an implementation in let store = PostgresSessionStore::new(&config.database_url)
.await
.expect("Could not connect to database.");
store.migrate().await.unwrap();
let service = ServiceBuilder::new().layer(
SessionLayer::new(store, config.app_secret.as_bytes())
.with_same_site_policy(SameSite::Lax)
.with_secure(false),
); |
Thanks for the links, I did view the docs and use the example. However with session_layer as the layer, it's not storing a record set in one handler which is retrievable in another handler. Perhaps it may be an idea to doc an example of an insert in one handler and a get in another handler. Redis is generally more widely used to store sessions, so if you could doc a Redis example, insert & get in separate handlers, that would be awesome. |
I have a relatively complex project with a redis session using this crate. When I'll have a little more free time, I'll submit a PR with a basic working example. The redis part is not that complicated imo, so basically I just followed the docs. Edit: |
Oh that's too bad: |
That would be ideal if async-redis-session enables Tokio as a feature flag. Thanks for all your input and help. |
@AppyCat I have a redis example here. I'm not going to submit a PR, as the |
I also added a sqlx example for reference. Given that |
@AppyCat we've released tower-sessions 0.1.0 which includes Redis support. |
Hi, I am able to insert a record into session in one handler but unable to retrieve it in another. Could you:
Since docs are not present in this crate currently, I proceeded with docs from async-sessions and got the following errors:
90 | let cookie_value = store.store_session(session).await;
| ^^^^^^^^^^^^^ method not found in
Result<RedisSessionStore, redis::types::RedisError>
error[E0599]: no method named
load_session
found for enumResult
in the current scope--> src/main.rs:91:29
|
91 | let mut session = store.load_session("test-cookie".parse().unwrap()).await.unwrap();
| ^^^^^^^^^^^^ method not found in
Result<RedisSessionStore, redis::types::RedisError>
From the following code:
Appreciate any help on this front.
The text was updated successfully, but these errors were encountered: