NewClient with lazy connections #903
Replies: 1 comment 6 replies
-
Yes, but keep in mind that this behavior is only available when
I think the lazy connect can be achieved easily with a new wrapper which implements the Would you like to contribute to the wrapper? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Rueian, thanks for creating this great package and sharing it with all of us.
I'm new to Rueidis and one thing that surprised me is that
rueidis.NewClient
eagerly connects to Redis. For example:Even if there's an
err
, theclient
can still be used and will gracefully attempt to connect on future calls. This resilience is great.What are your thoughts on adding the ability to lazily connect on the first call, similar to pgxpool?
I think this is preferable in many situations because it allows us to defer connecting until it's actually needed. This can speed up HTTP server initialization, for example.
Beta Was this translation helpful? Give feedback.
All reactions