xtn-tools-pro 1.0.1.4.3__py3-none-any.whl → 1.0.1.4.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xtn_tools_pro/db/RedisDB.py +31 -1
- xtn_tools_pro/task_pro/go_fun_v4.py +4 -0
- {xtn_tools_pro-1.0.1.4.3.dist-info → xtn_tools_pro-1.0.1.4.6.dist-info}/METADATA +1 -1
- {xtn_tools_pro-1.0.1.4.3.dist-info → xtn_tools_pro-1.0.1.4.6.dist-info}/RECORD +8 -8
- {xtn_tools_pro-1.0.1.4.3.dist-info → xtn_tools_pro-1.0.1.4.6.dist-info}/LICENSE +0 -0
- {xtn_tools_pro-1.0.1.4.3.dist-info → xtn_tools_pro-1.0.1.4.6.dist-info}/WHEEL +0 -0
- {xtn_tools_pro-1.0.1.4.3.dist-info → xtn_tools_pro-1.0.1.4.6.dist-info}/entry_points.txt +0 -0
- {xtn_tools_pro-1.0.1.4.3.dist-info → xtn_tools_pro-1.0.1.4.6.dist-info}/top_level.txt +0 -0
xtn_tools_pro/db/RedisDB.py
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
# --------------------------------------------------------------------------------------------------
|
|
11
11
|
import time
|
|
12
12
|
import redis
|
|
13
|
+
from redis import Redis
|
|
14
|
+
from typing import Optional
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
class RedisDBPro:
|
|
@@ -25,7 +27,7 @@ class RedisDBPro:
|
|
|
25
27
|
self._max_connections = max_connections # 同一个redis对象使用的并发数(连接池的最大连接数),超过这个数量会抛出redis.ConnectionError
|
|
26
28
|
self._kwargs = kwargs
|
|
27
29
|
# 连接
|
|
28
|
-
self.__redis = None
|
|
30
|
+
self.__redis: Optional[Redis] = None
|
|
29
31
|
self.get_connect()
|
|
30
32
|
|
|
31
33
|
def __del__(self):
|
|
@@ -174,6 +176,34 @@ class RedisDBPro:
|
|
|
174
176
|
def delete(self, table):
|
|
175
177
|
return self._redis.delete(table)
|
|
176
178
|
|
|
179
|
+
def hset(self, table: str, key=None, value=None, mapping=None):
|
|
180
|
+
"""
|
|
181
|
+
返回值:新增字段的个数(1表示新加;0表示覆盖了已有字段)
|
|
182
|
+
一次性设置多个字段:使用 mapping 参数(推荐)
|
|
183
|
+
:param table:
|
|
184
|
+
:param key:
|
|
185
|
+
:param value:
|
|
186
|
+
:param mapping:
|
|
187
|
+
:return:
|
|
188
|
+
"""
|
|
189
|
+
return self._redis.hset(name=table, key=key, value=value, mapping=mapping)
|
|
190
|
+
|
|
191
|
+
def hget(self,name,key):
|
|
192
|
+
"""
|
|
193
|
+
读单个
|
|
194
|
+
:param name: 表
|
|
195
|
+
:param key: key
|
|
196
|
+
:return:
|
|
197
|
+
"""
|
|
198
|
+
return self._redis.hget(name,key)
|
|
199
|
+
|
|
200
|
+
def hgetall(self,name):
|
|
201
|
+
"""
|
|
202
|
+
读全部字段(小 Hash 可用,大 Hash 慎用)
|
|
203
|
+
:param name:
|
|
204
|
+
:return:
|
|
205
|
+
"""
|
|
206
|
+
return self._redis.hgetall(name)
|
|
177
207
|
|
|
178
208
|
if __name__ == '__main__':
|
|
179
209
|
pass
|
|
@@ -41,6 +41,10 @@ class GoFunTaskV4:
|
|
|
41
41
|
download_task_qsize = ini_dict.get('download_task_qsize', 10) # 触发下载任务队列的最低阈值(当下载队列小于等于x时就立刻请求下载任务接口获取任务),默认10个
|
|
42
42
|
download_task_qsize = 10 if download_task_qsize < 0 else download_task_qsize # 触发下载任务队列的最低阈值(当下载队列小于等于x时就立刻请求下载任务接口获取任务),默认10个
|
|
43
43
|
|
|
44
|
+
if not task_type:
|
|
45
|
+
logger.critical(f"taskType:{task_type} 为空")
|
|
46
|
+
return
|
|
47
|
+
|
|
44
48
|
# 默认进程数和线程数
|
|
45
49
|
processes_num = 1 if processes_num <= 0 else processes_num
|
|
46
50
|
thread_num = 1 if thread_num <= 0 else thread_num
|
|
@@ -7,7 +7,7 @@ xtn_tools_pro/data/__init__.py,sha256=Cg6fMz1PlSjPa1LUyQtpzvvjvFdxiky_PjxaNFr3wI
|
|
|
7
7
|
xtn_tools_pro/data/set_data_pro.py,sha256=Cg6fMz1PlSjPa1LUyQtpzvvjvFdxiky_PjxaNFr3wIo,418
|
|
8
8
|
xtn_tools_pro/db/MongoDB.py,sha256=CljtA5NnutOPL0j2ClrCE4RXW-9N_306D3PAdRANmuk,5699
|
|
9
9
|
xtn_tools_pro/db/MysqlDB.py,sha256=SBJrcjbZdxmtTKPGwl57NthPhs4uX8J3P6o_rK01O4k,13373
|
|
10
|
-
xtn_tools_pro/db/RedisDB.py,sha256=
|
|
10
|
+
xtn_tools_pro/db/RedisDB.py,sha256=aFNuG7Ae_3ltTM0ua_SQBGqI5JkecmIlw5gzrzVgMXg,7427
|
|
11
11
|
xtn_tools_pro/db/__init__.py,sha256=Zg91UWS02TO0Ba_0AY56s0oabRy93xLNFkpIIL_6mMM,416
|
|
12
12
|
xtn_tools_pro/flask_demo/__init__.py,sha256=2hSMIjKC8-T_9aTJU35DjkwWKa1-ZzMgwfFajs69TWI,418
|
|
13
13
|
xtn_tools_pro/flask_demo/cli.py,sha256=wBcdWu5uN1QB8begyGHnhSln4IiZJPTFE8CDy0sQGTk,3116
|
|
@@ -55,7 +55,7 @@ xtn_tools_pro/task_pro/go_fun.py,sha256=hWEt2uJ9FCvJH7PhVZttS-11A7J6zbRKwX7c5YLY
|
|
|
55
55
|
xtn_tools_pro/task_pro/go_fun_air_v1.py,sha256=25gHmW5aAV6nMY9Y6-wD7uQ_wqE39dr-eaegqVbYKM8,11035
|
|
56
56
|
xtn_tools_pro/task_pro/go_fun_v2.py,sha256=SgcXgtEBGSVL1V2LyqO0z8Md2H8JZxucYrLLIwqtiLM,18489
|
|
57
57
|
xtn_tools_pro/task_pro/go_fun_v3.py,sha256=GI1OVup-izwDflAaoy_pN6xmCXat59II7v-MooOtDms,20862
|
|
58
|
-
xtn_tools_pro/task_pro/go_fun_v4.py,sha256=
|
|
58
|
+
xtn_tools_pro/task_pro/go_fun_v4.py,sha256=FvLN5zZohkzAzzVNAR0enwcyZ2aFntWPunqoK8nChl4,21325
|
|
59
59
|
xtn_tools_pro/utils/__init__.py,sha256=I1_n_NP23F2lBqlF4EOlnOdLYxM8M4pbn63UhJN1hRE,418
|
|
60
60
|
xtn_tools_pro/utils/audio_video.py,sha256=3Im3tGOW6IbmqDcrE1SJUg6eGyLGEyq11Qu6TCutJJw,1115
|
|
61
61
|
xtn_tools_pro/utils/crypto.py,sha256=B6NC2yVxtwrbSZnngudTFRm7YRGKKEusydVVYWwxFHs,5231
|
|
@@ -70,9 +70,9 @@ xtn_tools_pro/utils/shell.py,sha256=s6sJedxLLQokcI1hF5YSD3qgGUPK0brNcP-D3-yv54I,
|
|
|
70
70
|
xtn_tools_pro/utils/sql.py,sha256=EAKzbkZP7Q09j15Gm6o0_uq0qgQmcCQT6EAawbpp4v0,6263
|
|
71
71
|
xtn_tools_pro/utils/time_utils.py,sha256=TUtzG61PeVYXhaQd6pBrXAdlz7tBispNIRQRcGhE2No,4859
|
|
72
72
|
xtn_tools_pro/utils/win.py,sha256=D5_58WMKOGe9ZwJuJr2JGAWmVISwMOZUx4t7wXUCviU,3512
|
|
73
|
-
xtn_tools_pro-1.0.1.4.
|
|
74
|
-
xtn_tools_pro-1.0.1.4.
|
|
75
|
-
xtn_tools_pro-1.0.1.4.
|
|
76
|
-
xtn_tools_pro-1.0.1.4.
|
|
77
|
-
xtn_tools_pro-1.0.1.4.
|
|
78
|
-
xtn_tools_pro-1.0.1.4.
|
|
73
|
+
xtn_tools_pro-1.0.1.4.6.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
|
+
xtn_tools_pro-1.0.1.4.6.dist-info/METADATA,sha256=S5w2yvyH6LHUjR6z8LFJlOu0faZ3VIPaTDsDh936hXs,597
|
|
75
|
+
xtn_tools_pro-1.0.1.4.6.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
76
|
+
xtn_tools_pro-1.0.1.4.6.dist-info/entry_points.txt,sha256=t8CtXWOgw7nRDW3XNlZh8MT_P4l8EzsFnyWi5b3ovrc,68
|
|
77
|
+
xtn_tools_pro-1.0.1.4.6.dist-info/top_level.txt,sha256=jyB3FLDEr8zE1U7wHczTgIbvUpALhR-ULF7RVEO7O2U,14
|
|
78
|
+
xtn_tools_pro-1.0.1.4.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|