예제 #1
0
파일: dist_lock.py 프로젝트: adolf2v/QA
def goumai(i):
    with dist_lock('test',r):
        num=post.find_one({"_id":2})
        m=num.get('num')
        print m
        post.update({"_id":2},{"$set":{"num":m+i}})
예제 #2
0
#coding:utf-8
import redis
import time
from redis_netlock import dist_lock, ask_lock

client = redis.Redis(connection_pool=redis.BlockingConnectionPool(
    max_connections=15, host='localhost', port=6379))

with dist_lock('test', client) as l:
    time.sleep(10)
    print 'welcome to my blog, http://xiaorui.cc'
예제 #3
0
파일: test2.py 프로젝트: cluo/redis_netlock
from __future__ import with_statement
import redis
import time
from redis_netlock import dist_lock

client = redis.Redis(connection_pool=redis.BlockingConnectionPool(max_connections=15, host='localhost', port=6379))
with dist_lock('test', client):
    print 'hello'

예제 #4
0
from __future__ import with_statement
import redis
import time
from redis_netlock import dist_lock

client = redis.Redis(connection_pool=redis.BlockingConnectionPool(max_connections=15, host="localhost", port=6379))
with dist_lock("test", client):
    time.sleep(10)
    print "welcome to my blog, http://xiaorui.cc"