redlock-py | Redis distributed locks in Python | Architecture library
kandi X-RAY | redlock-py Summary
kandi X-RAY | redlock-py Summary
redlock-py - Redis distributed locks in Python. This python lib implements the Redis-based distributed lock manager algorithm described in this blog post.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Lock a key
- Lock an instance
- Unlock an instance
- Generate a random id
- Log a message to stderr
- Unlock a key
- Unlock a lock
redlock-py Key Features
redlock-py Examples and Code Snippets
Community Discussions
Trending Discussions on redlock-py
QUESTION
I am looking for a readers-writer lock that can be used in python in a distributed system.
So far I've found:
- redlock, which is based on redis. Does not provide a readers-writer lock.
- The distributed package of dask offers a lock, but again, no readers-writer lock.
- kazoo, which works with Zookeeper, offers a readers-writer lock. However Zookeeper is an extremely heavy dependency, as it written in Java and therefore requires the JDK.
Is there a more lightweight alternative to kazoo / Zookeeper? Ideally a pure python solution that is nevertheless battle tested?
...ANSWER
Answered 2020-Apr-05 at 16:31Redis is single-threaded and read/write operations are atomic; which means multiple simultaneous read/write operations will not succeed and readers and writer(s) will be obtaining access to the resource sequentially in atomic fashion. I believe this would solve your problem if the resource is kept in as one of the redis data structures. You do not need a separate reader-writer lock mechanism when using redis and python as combination where the resource is kept within redis.
Hope it helps
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install redlock-py
You can use redlock-py like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page