Skip to main content

Distributed locks with Redis

Project description

https://img.shields.io/pypi/implementation/redlock-plus?style=flat-square https://img.shields.io/pypi/pyversions/redlock-plus?style=flat-square https://github.com/provinzkraut/redlock-plus/workflows/Tests/badge.svg

Redlock+ is an up to date, feature complete implementation of the Redlock Algorithm It’s a spiritual successor to glasslion/redlock, which is no longer maintained.

Features

  • Compliant with the standard library Lock and RLock so it can be used as a drop-in replacement

  • Complete implementation of the Redlock Algorithm

  • Autoextend functionality to make redlock safer and easier to use

  • Well tested (Python 3.6+, PyPy3)

  • Type hinted

Documentation

https://redlock-plus.readthedocs.io/en/latest/

Installation

Redlock+ is available on PyPi:

pip install redlock-plus

Basic usage

from redlock_plus import Lock

redis_instance_configs = [
    {"url": "redis://localhost/0"},
    {"url": "redis://example.com:1234/1"},
    {"url": "redis://other.host:5678/2"},
]

with Lock("my_resource", redis_instance_configs):
    # do work

or speed up things for repeated use using the factory

from redlock_plus import LockFactory

redlock_factory = LockFactory(
    [
        {"url": "redis://localhost/0"},
        {"url": "redis://localhost/1"},
        {"url": "redis://localhost/2"},
    ]
)

with redlock_factory("my_resource"):
    # do work

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-plus-0.1.6.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

redlock_plus-0.1.6-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file redlock-plus-0.1.6.tar.gz.

File metadata

  • Download URL: redlock-plus-0.1.6.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0a2 CPython/3.10.0 Linux/5.11.0-41-generic

File hashes

Hashes for redlock-plus-0.1.6.tar.gz
Algorithm Hash digest
SHA256 d142a745531cbbbbf1158d4d0ed755f8958d9488b783c8d1920c75e08741d5d6
MD5 b5006145a4ed8750721a77daddd20cd7
BLAKE2b-256 4e5b06403e7607f227ff0ab5ff1dcd57f03caee597ad6acd80fd19736d523e8f

See more details on using hashes here.

File details

Details for the file redlock_plus-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: redlock_plus-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0a2 CPython/3.10.0 Linux/5.11.0-41-generic

File hashes

Hashes for redlock_plus-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ea031f2a75e33c0a8ac436c1b9318e7c09bc0e782a3d8113febd70f3ef035e52
MD5 5ccd5ec3a8b1feb894bb655619e0091c
BLAKE2b-256 63b54fdcc9ba84b0af43a5de27b6242f73f156c41e521f1f8d9cee44ee4f8090

See more details on using hashes here.

Supported by

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