fix: 修复应用保存报错

This commit is contained in:
shaohuzhang1 2024-08-26 13:36:50 +08:00 committed by shaohuzhang1
parent 9257677e4b
commit bb6f5d6096

View File

@ -61,3 +61,19 @@ class FileCache(BaseCache):
if value is None:
return None
return datetime.timedelta(seconds=math.ceil(expire_time - time.time()))
def clear_by_application_id(self, application_id):
delete_keys = []
for key in self.cache.iterkeys():
value = self.cache.get(key)
if (hasattr(value,
'application') and value.application is not None and value.application.id is not None and
str(
value.application.id) == application_id):
delete_keys.append(key)
for key in delete_keys:
self.delete(key)
def clear_timeout_data(self):
for key in self.cache.iterkeys():
self.get(key)