METADATA 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. Metadata-Version: 2.1
  2. Name: memcache-lock
  3. Version: 0.0.5
  4. Summary: Locking mechanism for Python 2.7 GAE, using memcache
  5. Home-page: https://github.com/linuxpi/memcache_lock
  6. Author: Varun Bansal
  7. Author-email: varunb94@gmail.com
  8. License: MIT
  9. Platform: UNKNOWN
  10. Classifier: Development Status :: 3 - Alpha
  11. Classifier: Intended Audience :: Developers
  12. Classifier: License :: OSI Approved :: MIT License
  13. Classifier: Operating System :: OS Independent
  14. Classifier: Programming Language :: Python :: 2
  15. # memcache_lock
  16. Simple locking mechanism for Python 2.7 GAE, using memcache
  17. ## Usage
  18. Import the UUIDLock class in any app engine module
  19. ```
  20. from memcache_lock import UUIDLock
  21. ```
  22. Acquire the lock
  23. ```
  24. lock_helper = UUIDLock(key='lock_key')
  25. lock_helper.lock()
  26. ```
  27. Release the lock
  28. ```
  29. lock_helper.release()
  30. ```
  31. ## Options
  32. ### You use other kwargs to control the lock mechanism
  33. Send default_timeout in secs to change the time after with the lock will be released automatically
  34. ```
  35. lock_helper = UUIDLock(key='lock_key', default_timeout=3600)
  36. ```
  37. **NOTE**: default value for timeout is 24 hours
  38. Send force_lock as True to acquire lock even if some other application already has lock on the key
  39. ```
  40. lock_helper = UUIDLock(key='lock_key', force_lock=True)
  41. ```
  42. **NOTE**: default value for force_lock is False
  43. Send max_wait_time in secs to raise Exception if lock is not acquired after waiting for max_wait_time
  44. ```
  45. lock_helper = UUIDLock(key='lock_key', max_wait_time=120)
  46. ```
  47. **NOTE**: default value for max_wait_time is 60 secs