def cleanupAssociations(self):
"""Remove expired associations from the store.
This method is not called in the normal operation of the
library. It provides a way for store admins to keep
their storage from filling up with expired data.
@return: the number of associations expired.
@returntype: int
"""
try:
mist_associations = MistAssociation.objects()
except me.DoesNotExist:
mist_associations = []
counter = 0
for assoc in mist_associations:
if assoc.is_expired():
assoc.delete()
counter += 1
return counter
评论列表
文章目录