Home > database >  Using the StackExchange. Redis operation produces ABA Redis affairs
Using the StackExchange. Redis operation produces ABA Redis affairs

Time:09-16

ConnectionMultiplexer con=ConnectionMultiplexer. Connect (" 127.00.1:6379 ");//- 1 instantiated client
IDatabase db=con. GetDatabase ();//access database - 2
Var tran=the CreateTransaction ();//create things - 3
Tran. AddCondition (Condition. StringEqual (" key ", "40"));//- 4 optimistic locking
Tran. StringSetAsync (" key ", "60"); - 5 other client changed the key value
Bool result=tran. The Execute ();//submit things - 6

There is a problem:
When you perform step 4, as the key corresponding to the value of value is 40,
When performing until the step 6, with the value of the key in the client has changed into 30 B, then by the client to 40 C,
Step 6 to commit the transaction, I found that still can submit success, it isn't that ABA?

I use Redis client watch, multi, exec will not ABA problem, why use the StackExchange. Redis will appear,
  • Related