Distribute lock system's client.
Project description
Distribute lock system’s client.
Install
pip install distlock-client
Usage
Use Lock apis.
from distlock_client import Lock from distlock_client import get_app_unique_name from .services import do_something def view01(request): lockName = "view01_lock" appid = get_app_unique_name() server = "http://127.0.0.1/" lock = Lock(appid, server) locked = lock.safe_acquire(lockName, 60) if locked: try: do_something() finally: lock.safe_release(lockName)
Use with statement.
from distlock_client import Lock from distlock_client import distlock from distlock_client import get_app_unique_name from .services import do_something def view01(request): lockName = "view01_lock" appid = get_app_unique_name() server = "http://127.0.0.1/" lock = Lock(appid, server) with distlock(lock, lockName) as locked: if locked: do_something()
Misc
Available servers.
django-distlock-server [python, django, database backend]
django-distlock-server-redis [python, django, redis backend]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
distlock-client-0.1.0.tar.gz
(2.4 kB
view hashes)