forked from couchbaselabs/pydcp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmcdclient.py
44 lines (34 loc) · 1022 Bytes
/
mcdclient.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import logging
from conn import Connection
from constants import *
from op import *
class McdClient():
def __init__(self, host='127.0.0.1', port=11211):
self.conn = Connection(host, port)
self.conn.connect()
def stats(self, type = ''):
op = Stats(type)
self.conn.queue_operation(op)
return op
def set(self, key, value, vbucket, flags, exp):
op = Set(key, value, vbucket, flags, exp)
self.conn.queue_operation(op)
return op
def delete(self, key, vbucket):
op = Delete(key, vbucket)
self.conn.queue_operation(op)
return op
def flush(self):
op = Flush()
self.conn.queue_operation(op)
return op
def start_persistence(self):
op = StartPersistence()
self.conn.queue_operation(op)
return op
def stop_persistence(self):
op = StopPersistence()
self.conn.queue_operation(op)
return op
def shutdown(self):
self.conn.close()