Cache::Memcached::Lock

Cahill, Earl ecahill at corp.untd.com
Mon Sep 26 09:29:01 PDT 2005


Though it doesn't fully exist yet, I have been pondering writing a
locking system built around memcached, and specifically the add method.
I wrote such a system for my own use the other night, would like to
generalize it a bit and would like to open source it.  I would also like
to pattern it around something open sourced from work to allow for
locking over nfs, namely File::NFSLock

 

http://search.cpan.org/src/BBB/File-NFSLock-1.20/README

 

Course, a locking system using memcached wouldn't really care about nfs,
which is kind of the beauty.  I would plan on mimicking a few
File::NFSLock functions, like returning a lock object that unlocks when
it leaves scope, blocking and non-blocking locks, blocking timeouts and
stale lock timeouts.  Instead of locking on a file, one would lock on an
arbitrary word.

 

In my tests going between two athlon 3200+s, I got around 10,000
add/delete cycles per second.

 

I am not saying it would be a hard module to write, especially since add
does most of the work, but I think it could be quite useful.  My module
from the other night, which by design, does some weird thing where only
one process per second gets the lock, has already solved a few problems
for me.  It might also be that such a thing exists, but in my cpan
searchings, I couldn't find anything.

 

As a final note, whoever was responsible 1.1.12 and for fixing the slow
delete problem, many thanks.  Just before I filed a bug report, or at
least emailed the list, I checked the changes and found what I needed.
Also wondering how to get version 1.1.12 into debian distributions.

 

Feedback welcome.

 

Earl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20050926/3638b95f/attachment.htm


More information about the memcached mailing list