add hack code
This commit is contained in:
parent
12e8ccd01c
commit
b877ab13b3
2 changed files with 23 additions and 6 deletions
|
|
@ -86,10 +86,23 @@ class DB(object):
|
|||
return self._db_clients[0].put(self.realkey(key), value, **kwargs)
|
||||
|
||||
@readable_errors
|
||||
def increment(key, **kwargs):
|
||||
with self._db_clients[0].lock(key) as lock:
|
||||
value = int(self.get(self.realkey(key), **kwargs))
|
||||
self.set(self.realkey(key), str(value + 1), **kwargs)
|
||||
def increment(self, key, **kwargs):
|
||||
print(self.realkey(key))
|
||||
|
||||
|
||||
print("prelock")
|
||||
lock = self._db_clients[0].lock('/nicohack/foo')
|
||||
print("prelockacq")
|
||||
lock.acquire()
|
||||
print("prelockrelease")
|
||||
lock.release()
|
||||
|
||||
with self._db_clients[0].lock("/nicohack/mac/last_used_index") as lock:
|
||||
print("in lock")
|
||||
pass
|
||||
|
||||
# with self._db_clients[0].lock(self.realkey(key)) as lock:# value = int(self.get(self.realkey(key), **kwargs))
|
||||
# self.set(self.realkey(key), str(value + 1), **kwargs)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue