On Apr 8, 4:37 pm, Earl Cahill <[email protected]> wrote: > And I wrote IPC::Lock::Memcached for it. > > http://search.cpan.org/~earl/IPC-Lock-0.14/lib/IPC/Lock/Memcached.pm
Yes, but there are undesirable properties: 1) May release locks unexpectedly and without warning (and not just when you're on the edge of memory availability). 2) Will not automatically release locks when a client crashes or otherwise disconnects. 3) Has no ability to block for the availability of a lock (requiring polling to check for lock availability). It's the same sort of problems you run into when trying to use memcached as a work queue. It's *possible* but it doesn't offer the guarantees you should be building upon. For example, it's quite likely you've given the same lock out to two different processes without knowing it. It's the same class of bugs as concurrency bugs -- you can have two threads occasionally write to the same spot in memory without mutexes and have it actually work a lot of the time. It will just stop working when you least expect it and it will show up in strange ways.
