Skip to content

Question About Using Multiplexed Redis in Actix Web #3461

Answered by robjtede
tyrsday29 asked this question in Q&A
Discussion options

You must be logged in to vote

ThinData is for database pools and other types which share state internally, via Arc or whatever other method.

Key point from the ThinData docs:

Unlike Data, this wrapper clones T during extraction. Therefore, it is the user’s responsibility to ensure that clones of T do actually share the same state, otherwise state may be unexpectedly different across multiple requests.

I'd probably still recommend putting the redis::Client in app data and not the connection itself, but using client.get_multiplexed_async_connection().await when you need it.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tyrsday29
Comment options

Answer selected by robjtede
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants