- The algorithm requires a minimum of three Redis instances to work.
- The client generates a random value called
nonce
and tries to acquire a lock on a resource by sending aSET
command to each of the Redis instances with the sameresource_name
andnonce
values. - The
SET
command should include anEX
parameter to set an expiration time for the lock. - If the client can acquire the lock on a majority of the Redis instances, it is considered to have acquired the lock.
- If the client fails to acquire the lock on a majority of the Redis instances, it should release the lock on all the instances where it was acquired.
- To release the lock, the client sends a
DEL
command to all the Redis instances where it had acquired the lock.
This site is built on Heroku
Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)