debasishg / scala-redis

A scala library for connecting to a redis server, or a cluster of redis nodes using consistent hashing on the client side.
1.02k stars 219 forks source link

QUESTION - should `RedisClient` be shared or used as a singleton? #289

Closed reynoldsm88 closed 2 years ago

reynoldsm88 commented 2 years ago

To elaborate, if I am creating multiple processors (eg: Akka Actors) that need to interact with Redis, can I reuse the RedisClient instance or should each processor spawn it's own instance?

noahlz commented 2 years ago

RedisClients should not be shared between threads, and there is a RedisClientPool provided with the library to facilitate safe concurrent programming.

noahlz commented 2 years ago

See "Using Client Pooling" in the readme

reynoldsm88 commented 2 years ago

@noahlz thanks! closing this issue