azurecachingredisstackexchange.redisazure-redis-cache

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.


Solution

  • 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