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

The Linux Command Line

The Linux Command Line

William E. Shotts Jr. / No Starch Press, Incorporated / 2012-1-17 / USD 39.95

You've experienced the shiny, point-and-click surface of your Linux computer-now dive below and explore its depths with the power of the command line. The Linux Command Line takes you from your very ......一起来看看 《The Linux Command Line》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

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

在线图片转Base64编码工具

随机密码生成器
随机密码生成器

多种字符组合密码