perf: Memory optimization
Some checks failed
sync2gitee / repo-sync (push) Has been cancelled
Typos Check / Spell Check with Typos (push) Has been cancelled

This commit is contained in:
shaohuzhang1 2025-11-14 22:02:29 +08:00
parent b8eb7b11bf
commit 73e07f165a

View File

@ -272,7 +272,7 @@ class ChatInfo:
index=chat_record_dict.get('index'), ) index=chat_record_dict.get('index'), )
def set_cache(self): def set_cache(self):
cache.set(Cache_Version.CHAT.get_key(key=self.chat_id), json.dumps(self.to_dict(), cls=SystemEncoder), cache.set(Cache_Version.CHAT.get_key(key=self.chat_id), self.to_dict(),
version=Cache_Version.CHAT_INFO.get_version(), version=Cache_Version.CHAT_INFO.get_version(),
timeout=60 * 30) timeout=60 * 30)
@ -291,5 +291,5 @@ class ChatInfo:
chat_info_dict = cache.get(Cache_Version.CHAT.get_key(key=chat_id), chat_info_dict = cache.get(Cache_Version.CHAT.get_key(key=chat_id),
version=Cache_Version.CHAT_INFO.get_version()) version=Cache_Version.CHAT_INFO.get_version())
if chat_info_dict: if chat_info_dict:
return ChatInfo.map_to_chat_info(json.loads(chat_info_dict)) return ChatInfo.map_to_chat_info(chat_info_dict)
return None return None