Skip to main content

Locking mechanism for Python 2.7 GAE, using memcache

Project description

# memcache_lock Simple locking mechanism for Python 2.7 GAE, using memcache

## Usage

Import the UUIDLock class in any app engine module

` from memcache_lock import UUIDLock `

Acquire the lock

` lock_helper = UUIDLock(key='lock_key') lock_helper.lock() `

Release the lock

` lock_helper.release() `

## Options

### You use other kwargs to control the lock mechanism

Send default_timeout in secs to change the time after with the lock will be released automatically ` lock_helper = UUIDLock(key='lock_key', default_timeout=3600) ` NOTE: default value for timeout is 24 hours

Send force_lock as True to acquire lock even if some other application already has lock on the key ` lock_helper = UUIDLock(key='lock_key', force_lock=True) ` NOTE: default value for force_lock is False

Send max_wait_time in secs to raise Exception if lock is not acquired after waiting for max_wait_time ` lock_helper = UUIDLock(key='lock_key', max_wait_time=120) ` NOTE: default value for max_wait_time is 60 secs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for memcache-lock, version 0.0.5
Filename, size File type Python version Upload date Hashes
Filename, size memcache_lock-0.0.5-py2-none-any.whl (3.6 kB) File type Wheel Python version py2 Upload date Hashes View hashes
Filename, size memcache_lock-0.0.5.tar.gz (2.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page