add bg_save on delete option

This commit is contained in:
Simon 2025-03-09 20:34:21 +07:00
parent 45907cad8b
commit 01f2b42d33

View File

@ -107,9 +107,12 @@ class RedisArchivist(RedisBase):
return [self.get_message_dict(i) for i in all_matches] return [self.get_message_dict(i) for i in all_matches]
def del_message(self, key: str) -> bool: def del_message(self, key: str, save: bool = False) -> bool:
"""delete key from redis""" """delete key from redis"""
response = self.conn.execute_command("DEL", self.NAME_SPACE + key) response = self.conn.execute_command("DEL", self.NAME_SPACE + key)
if save:
self.bg_save()
return response return response