|
@@ -20,6 +20,9 @@ p=print
|
20
|
20
|
async def anop(*a,**kw):pass
|
21
|
21
|
def nop(*a,**kw):pass
|
22
|
22
|
|
|
23
|
+def connect_redis():
|
|
24
|
+ return redis.Redis(host='localhost', port=6379, db=0,charset="utf-8", decode_responses=True, encoding_errors="backslashreplace")
|
|
25
|
+
|
23
|
26
|
|
24
|
27
|
'''
|
25
|
28
|
# '''
|
|
@@ -32,7 +35,7 @@ class globCL():
|
32
|
35
|
# for now we are not going to do any weird class stuff
|
33
|
36
|
cls = self.__class__
|
34
|
37
|
cls.init_cnt += 1
|
35
|
|
-
|
|
38
|
+ self.r = connect_redis()
|
36
|
39
|
pass
|
37
|
40
|
async def persistent_loop(self,*a,**kw):
|
38
|
41
|
pass
|
|
@@ -50,3 +53,42 @@ glob_cl = globCL()
|
50
|
53
|
|
51
|
54
|
|
52
|
55
|
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+def redis_info():
|
|
65
|
+ rconn = glob_cl.r
|
|
66
|
+ keys = rconn.keys()
|
|
67
|
+ for k in keys():
|
|
68
|
+ p(":",k)
|
|
69
|
+
|
|
70
|
+ p("len(keys)",len(keys))
|
|
71
|
+ print("",end="",flush=True)
|
|
72
|
+redis_info()
|
|
73
|
+r"""
|
|
74
|
+
|
|
75
|
+def atexit_fn():
|
|
76
|
+ pass
|
|
77
|
+ # rconn.flushall()
|
|
78
|
+ print("ATEXIT FN")
|
|
79
|
+ rinfo_len()
|
|
80
|
+ keys = rconn.keys()
|
|
81
|
+ print(keys)
|
|
82
|
+ print(len(keys))
|
|
83
|
+ print("t 000")
|
|
84
|
+ # time.sleep(10)
|
|
85
|
+ print("t 010")
|
|
86
|
+ # time.sleep(20)
|
|
87
|
+ print("t 020")
|
|
88
|
+ print("ATEXIT FN...")
|
|
89
|
+ rconn.flushall()
|
|
90
|
+atexit.register(atexit_fn)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+# """
|