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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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