mdbq 4.0.107__tar.gz → 4.0.109__tar.gz
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.
Potentially problematic release.
This version of mdbq might be problematic. Click here for more details.
- {mdbq-4.0.107 → mdbq-4.0.109}/PKG-INFO +1 -1
- mdbq-4.0.109/mdbq/__version__.py +1 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/redis/redis_cache.py +15 -5
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq.egg-info/PKG-INFO +1 -1
- mdbq-4.0.107/mdbq/__version__.py +0 -1
- {mdbq-4.0.107 → mdbq-4.0.109}/README.txt +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/__init__.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/auth/__init__.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/auth/auth_backend.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/auth/rate_limiter.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/js/__init__.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/js/jc.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/log/__init__.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/log/mylogger.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/myconf/__init__.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/myconf/myconf.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/mysql/__init__.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/mysql/deduplicator.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/mysql/mysql.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/mysql/s_query.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/mysql/unique_.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/mysql/uploader.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/other/__init__.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/other/download_sku_picture.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/other/error_handler.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/other/otk.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/other/pov_city.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/other/ua_sj.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/pbix/__init__.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/pbix/pbix_refresh.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/pbix/refresh_all.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/redis/__init__.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/redis/getredis.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/route/__init__.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/route/analytics.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/route/monitor.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/route/routes.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/selenium/__init__.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/selenium/get_driver.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq/spider/__init__.py +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq.egg-info/SOURCES.txt +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq.egg-info/dependency_links.txt +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/mdbq.egg-info/top_level.txt +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/setup.cfg +0 -0
- {mdbq-4.0.107 → mdbq-4.0.109}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = '4.0.109'
|
|
@@ -15,7 +15,7 @@ import json
|
|
|
15
15
|
import time
|
|
16
16
|
import threading
|
|
17
17
|
import socket
|
|
18
|
-
from datetime import datetime
|
|
18
|
+
from datetime import datetime, date
|
|
19
19
|
from typing import Optional, Dict, Any, List, Union
|
|
20
20
|
import redis
|
|
21
21
|
from mdbq.log import mylogger
|
|
@@ -32,6 +32,16 @@ logger = mylogger.MyLogger(
|
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
class DateTimeEncoder(json.JSONEncoder):
|
|
36
|
+
"""自定义JSON编码器,支持datetime和date对象"""
|
|
37
|
+
def default(self, obj):
|
|
38
|
+
if isinstance(obj, datetime):
|
|
39
|
+
return obj.isoformat()
|
|
40
|
+
elif isinstance(obj, date):
|
|
41
|
+
return obj.isoformat()
|
|
42
|
+
return super().default(obj)
|
|
43
|
+
|
|
44
|
+
|
|
35
45
|
class CacheConfig:
|
|
36
46
|
"""缓存系统配置类"""
|
|
37
47
|
|
|
@@ -49,8 +59,8 @@ class CacheConfig:
|
|
|
49
59
|
self.lock_prefix = "cache_lock:"
|
|
50
60
|
|
|
51
61
|
# 统计配置
|
|
52
|
-
self.stats_interval =
|
|
53
|
-
self.stats_retention =
|
|
62
|
+
self.stats_interval = 1800 # 统计间隔(秒), 自动提交统计信息到MySQL的间隔
|
|
63
|
+
self.stats_retention = 7 # MySQL统计数据保留天数,超过此天数的数据将被自动删除
|
|
54
64
|
|
|
55
65
|
# 性能配置
|
|
56
66
|
self.max_key_length = 250
|
|
@@ -258,7 +268,7 @@ class SmartCacheSystem:
|
|
|
258
268
|
|
|
259
269
|
# 序列化值
|
|
260
270
|
if isinstance(value, (dict, list, tuple)):
|
|
261
|
-
serialized_value = json.dumps(value, ensure_ascii=False)
|
|
271
|
+
serialized_value = json.dumps(value, ensure_ascii=False, sort_keys=True, cls=DateTimeEncoder)
|
|
262
272
|
else:
|
|
263
273
|
serialized_value = str(value)
|
|
264
274
|
|
|
@@ -471,7 +481,7 @@ class SmartCacheSystem:
|
|
|
471
481
|
stats_data['ops_per_second'],
|
|
472
482
|
stats_data['unique_keys_count'],
|
|
473
483
|
stats_data['uptime_seconds'],
|
|
474
|
-
json.dumps(stats_data['hot_keys'], ensure_ascii=False),
|
|
484
|
+
json.dumps(stats_data['hot_keys'], ensure_ascii=False, cls=DateTimeEncoder),
|
|
475
485
|
socket.gethostname(),
|
|
476
486
|
self.instance_name
|
|
477
487
|
))
|
mdbq-4.0.107/mdbq/__version__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = '4.0.107'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|