I would be much safer to use spring data redis in multiple redises environment, with both masters and read-only slaves, with possibility to configure the connection factory as "read only" or "read & write".
To make this setting work spring data redis would have to make a test when creating the connection factory if this redis is in fact read only or read&write.
It could make a test SET operation with random key with "spring-data-redis-" prefix for safety and check for read only exception. It exception would not be recieved a DEL to clean up would be performed.
Of cource the result of this test would be used to continue running or throw an exception if inapproprate type of connection factory would be set for this redis
Rationale: We use this kind of environment and have had some problems with using read only redis by mistake in connection factory that we later used for read&write. The key word here is "later" - if above implementation would be included we would learn about our mistake just after running the application. Our problem was that the write operations came some time after starting it, long after we had stopped watching the logs..
DATAREDIS-580 Support Master/Slave connections using Lettuce
("is superseded by")
The text was updated successfully, but these errors were encountered: