Reputation: 155
I have two different .Net Core services and both of them read data from Redis.
The first application, writes a data in JSON format in a Redis key.
After this, the first application calls the second application, this is done via RabbitMQ.
When the second application reads the same data that was written by the first one, the value seams to be out of date, it appears to be the same value as before the first aplication updated the key.
Because I have some information whether the value was correct or not, I have implemented a retry code, and the value do changes after a feal retries.
I am using StackExchange.Redis library, and my question is: after the await
in the method StringSetAsync
, is the value actually updated, or is it just sent to a queue or something, so it can be updated later?
This problem does not happens always, and it appears to happen only with large values that are stored in the key.
StackExchange.Redis version: 2.0.601 Redis version: 5.0.4
Upvotes: 0
Views: 753
Reputation: 54
I think the problem is that you use the StringSetAsync and so the value is not set just after that operation, as you say it happens with large values which may take more time to be written. I suggest you to try with StringSet, which is synchronous, instead of StringSetAsync
Upvotes: 1