Skip to main content

Distributed locks with Redis

Project description

RedLock logo

RedLock - Distributed locks with Redis and Python

Build Status

This library implements the RedLock algorithm introduced by @antirez

The detailed description of the RedLock algorithm can be found in the Redis documentation: Distributed locks with Redis.

The redlock.RedLock class shares a similar API with the threading.Lock class in the Python Standard Library.

Simple Usage

from redlock import RedLock
lock =  RedLock("distributed_lock")
lock.acquire()
do_something()
lock.release()

With Statement / Context Manager

As with threading.Lock, redlock.RedLock objects are context managers thus support the With Statement. Thsi way is more pythonic and recommended.

from redlock import RedLock
with RedLock("distributed_lock"):
    do_something()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redlock-0.1.4.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

redlock-0.1.4-py2-none-any.whl (4.7 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page