2012-11-06 10:27 pm
Entry tags:

Redis: locking vs transactions

Suppose we need to load data from Redis, change it, and save it back. Looks easy. Here's the pseudocode.

data = redis.get(id);
redis.set(id, data);

Now, we notice that several threads (processes, execution contexts, whatever) may access the same data, and overwrite it! So, let's use transactions.

Read more... )