Python分布式锁 Sherlock

码农软件 · 软件分类 · 并发/并行处理框架 · 2019-09-02 20:42:51

软件介绍

Sherlock 是一个易用的 Python 分布式进程内锁机制库,你可选择锁同步的不同后台。

示例代码:

import sherlock
from sherlock import Lock

# Configure Sherlock's locks to use Redis as the backend,
# never expire locks and retry acquiring an acquired lock after an
# interval of 0.1 second.
sherlock.configure(backend=sherlock.backends.REDIS,
                   expire=None,
                   retry_interval=0.1)

# Note: configuring sherlock to use a backend does not limit you
# another backend at the same time. You can import backend specific locks
# like RedisLock, MCLock and EtcdLock and use them just the same way you
# use a generic lock (see below). In fact, the generic Lock provided by
# sherlock is just a proxy that uses these specific locks under the hood.

# acquire a lock called my_lock
lock = Lock('my_lock')

# acquire a blocking lock
lock.acquire()

# check if the lock has been acquired or not
lock.locked() == True

# release the lock
lock.release()

本文地址:https://codercto.com/soft/d/13743.html

复制互联网之2

复制互联网之2

文飞翔//刘伟 / 清华大学出版社 / 2011-6 / 45.00元

《复制互联网之2:2011年全球最值得模仿的100个网站》从行业的整体发展趋势中,收录了国内外最值得关注的互联网商业模式,为初创网站设计者提供了诸多可供借鉴的最具有启发价值的商业案例。此外,《复制互联网之2:2011年全球最值得模仿的100个网站》对前沿互联网产品的介绍和思考,也值得网站开发人员、产品设计人员及公司管理人员在产品和运营的创新上借鉴与参考。 作者是网易科技频道的编辑,长期致力于......一起来看看 《复制互联网之2》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具