scala-redis icon indicating copy to clipboard operation
scala-redis copied to clipboard

Concurrency problems when updating Redis

Open StelaLeon opened this issue 7 years ago • 1 comments

When using the client in a multi-threaded execution context, the cache gets updated with overlapped values as in <value String> $3 SET $6 <value String>. Running the Redis operations in a single threaded execution context. Race condition on its own variables. should be fixed by the library.

StelaLeon avatar Oct 04 '16 08:10 StelaLeon

To use in multithreaded context you need to use pooled connections, as Redis is single threaded. You can take a look at https://github.com/debasishg/scala-redis/blob/master/src/test/scala/com/redis/PoolSpec.scala

debasishg avatar Oct 16 '16 16:10 debasishg