Пример #1
0
def lock_nodes(nodes):
    LOCK_INTERVAL = 5 * 60
    if not isinstance(nodes, list):
        nodes = [nodes]
    r = Common.get_cache_connection()
    for node in nodes:
        r.set(node, node, ex=LOCK_INTERVAL, nx=True)
    return nodes
Пример #2
0
def is_locked(node):
    r = Common.get_cache_connection()
    return r.exists(node)
Пример #3
0
def release_lock(nodes):
    r = Common.get_cache_connection()
    r.delete(nodes)