Grokking Redis
0% completed
4.6 Lock Safety, Fencing, and Redlock
Two clients can hold lock:order:42 at the same moment even when every command of the basic lock works as designed. The previous lesson built that lock: SET NX PX with a random token to acquire it, a conditional release with DELEX or Lua, a TTL sized from p99 durations, and lease extension with SET IFEQ.
This lesson explains why such a lease cannot guarantee mutual exclusion and how fencing tokens make the protected resource reject a stale holder. It then describes the Redlock algorithm and the debate about its safety, and it ends with a lock strategy for each kind of work.
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%