IPC::Lock::Memcached

Perrin Harkins perrin at elem.com
Fri Oct 21 10:40:32 PDT 2005


On Fri, 2005-10-21 at 10:20 -0700, Cahill, Earl wrote:
> I will likely write IPC::Lock::DB, which will require you to pass in a
> dbh, and then do the rest for you.  I can't really see too many
> differences between mysql, postgres, oracle or any db that allows for
> temporary tables, has an atomic insert, and is say ansi 92 compliant.
> I will likely ensure that a temporary table exists on instantiation,
> then use that table for locking.

MySQL has a GET_LOCK function which is probably more appropriate for
this.

> That and it automatically unlocks when your lock object leaves
> scope.  

I've become wary of using scoping in Perl this way since seeing all the
problems that people have with Apache::Session and Class::DBI objects
not going out of scope.  A suggestion in the docs to call unlock()
explicitly might be good.

> Feedback welcome.

Some kind of advisory note about making sure you have enough free space
on your memcached server and the possibility of losing your locks if one
of your memcached servers goes away (I think GET_LOCK in MySQL has the
same risk) would be nice.

- Perrin



More information about the memcached mailing list