Implements a locking primitive using redis. An implementation of the algorithm described at http://redis.io/commands/setnx