A Lock Is Only as Good as Its Release
SETNX gets all the attention, but most of the bugs in ePHPm's KV locks were on the release side. This is how blind deletes, a missing compare-and-delete and a cluster where two nodes could both win got fixed.
Every “build a lock on Redis” tutorial spends its time on acquisition: SET key value NX PX 30000, one winner, done. The
release gets one line, DEL key. That line is where most of the lock bugs I’ve had in ePHPm lived. Over about three
months the same mistake showed up in three places. First the native session handler, then two of the Composer wrapper
packages, and finally the cluster. Each time it wore a slightly different costume.
