Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any lock mechanism in Azure Redis Cache while updating an item?

I'm working on Azure Redis Cache with Azure Search but I couldn't find any clear description about concurrency of Redis Cache.

Here is the case. While overwriting an existing cache item, is it possible to read the item at the same exact time? If yes how does Redis Cache manage this ? Does it lock the item until it gets available or does it give an old version of the item ?

By the way I'm using StackExchange.Redis client.

like image 707
Can Atuf Kansu Avatar asked Sep 07 '15 11:09

Can Atuf Kansu


1 Answers

Redis is single threaded so all operations are atomic. If there is an update/delete there is nobody else that can read that key until the operation finishes. More details here - single-threaded-nature-of-redis

like image 58
Liviu Costea Avatar answered Nov 05 '22 08:11

Liviu Costea