Skip to main content

Distributed lock using Redis

Project description

A distributed lock using Redis. Inspired by Sherlock.

https://travis-ci.org/jbochi/bullock.svg?branch=master

Installation

$ pip install bullock

Usage

from bullock import Bullock
lock = Bullock(host="redis-hostname", key="my-first-lock", ttl=3600)
lock.acquire(blocking=True)
# do critical work here
lock.release()

You can also use the with statement:

from bullock import Bullock
with Bullock(host="redis-hostname", key="my-first-lock", ttl=3600):
    # do critical work here

Also supports using redis cluster:

from bullock import Bullock
lock = Bullock(host="redis-hostname", key="my-first-lock", ttl=3600, redis_cluster=True)
lock.acquire(blocking=True)
# do critical work here
lock.release()

For more examples, see tests.

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

bullock-1.0.0.tar.gz (2.2 kB view details)

Uploaded Source

File details

Details for the file bullock-1.0.0.tar.gz.

File metadata

  • Download URL: bullock-1.0.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for bullock-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f8b09c39a37339df462f25fb71f5630a046d5905982c8a8fcfd7bd890c92e1ef
MD5 9c92cdbe6f7866fd6f9619342f479334
BLAKE2b-256 c33b359f7ab2eb5c983c9745ac2105dde89d7aad5762df20ac3dd44cea320d98

See more details on using hashes here.

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