Using Redis as a Distributed Lock with Lettuce
The source code for this article can be found on Github.
Using Redis as a best effort locking mechanism can be very useful in practice, to prevent two logical threads from clobbering each other. While redis locking is certainly not perfect, and you shouldn’t use redis locking if the underlying operation can’t be occasionally done twice, it can still be useful for that “best effort, do this once” use case.