Pretty nice! It's similar to my https://github.com/stagas/atomic but
mine's only in-process. One way you could simplify the API further is
to pass the client once and return a function: lock =
require('redis-lock')(client); lock('foo', fn);
I also found it's convenient to pass the lock key and extra arguments
to the callback, to save you a closure in a for/while loop.

-stagas

2012/6/19 Rakesh Pai <[email protected]>:
> I put this up on github a couple of days ago:
> https://github.com/errorception/redis-lock
>
> It's an implementation of a locking primitive using redis. It's great
> for when you want to ensure that you don't run into concurrency issues
> when using the node event loop heavily, or with multiple instances of
> node. It doesn't block the event loop at all, yet ensures that your
> functions execute in order (across processes), to ensure integrity.
> it's kinda niche, but when you need it you need it badly. I've been
> using this myself on http://errorception.com kinda heavily, and it
> seems to do the job very well. I've tried hard to keep the API real
> simple - just one function call! Depends on Redis, because I wanted
> the lock to be sitting out of the node process, so that multiple
> (node) processes can find out about it.
>
> Feedback welcome, of course. Let me know what you think. (My first
> node thing on github! Also, my first github thing! :D )
>
> --
> Rakesh Pai
> Mumbai, India.
> http://rakeshpai.me/
> http://twitter.com/rakesh314
> http://www.google.com/profiles/rakeshpai
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: 
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to