Skip to main content

Distribute lock system's client.

Project description

https://travis-ci.org/appstore-zencore/distlock-client.svg?branch=master

Distribute lock system’s client.

Install

pip install distlock-client

Usage

  1. 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)
  1. 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

  1. Available servers.

  • django-distlock-server [python, django, database backend]

  • django-distlock-server-redis [python, django, redis backend]

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

distlock-client-0.1.0.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file distlock-client-0.1.0.tar.gz.

File metadata

  • Download URL: distlock-client-0.1.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for distlock-client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 25b0386269b22a41e4f783cff8da4070adb432061be631333b78582735df117c
MD5 44ea1011fc7fbcf8fb5ee5912d3db82e
BLAKE2b-256 3469875db032bfd82e43d0cc9df78ec9c866d88f3345d0cb955a3d85e109e75d

See more details on using hashes here.

Provenance

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