mongolock:带有 mongodb 后端的 Python 分布式锁

时间:2024-06-26 12:32:53
【文件属性】:

文件名称:mongolock:带有 mongodb 后端的 Python 分布式锁

文件大小:6KB

文件格式:ZIP

更新时间:2024-06-26 12:32:53

Python

用法 from mongolock import MongoLock lock = MongoLock() # you can use it as context: # (if lock is already taken by another worker, MongoLockLocked will be raised) with lock('key', 'my_worker_name', expire=60, timeout=10): # some work here # or simply by calling methods: if lock.lock('key', 'my_worker_name'): try: # some useful work finally: lock.release('key', 'my_worker


【文件预览】:
mongolock-master
----MANIFEST.in(26B)
----src()
--------test_mongolock.py(3KB)
--------mongolock.py(5KB)
----requirements.txt(20B)
----LICENSE(1KB)
----setup.py(2KB)
----README.md(3KB)
----.gitignore(308B)

网友评论