luca3m / redis3m

A C++ Redis client
Apache License 2.0
190 stars 78 forks source link

Is redis3m thread safe? #23

Closed typcn closed 9 years ago

typcn commented 9 years ago

I want to use redis3m in my web service , is it thread safe ?

luca3m commented 9 years ago

Hi,

Yes it is. You can share simple_pool or connection_pool classes between threads and get a usable connection object when each thread needs to use a connection. The former is useful when you have a single redis instance, the latter if you have master/slaves managed by sentinels. Follow examples here and here, if you have other questions ask here. Using C++11 lambdas, there are convenient methods to auto-retry you database related code if connection fails.

typcn commented 9 years ago

OK , Thanks for response.