优化缓存,将会话的缓存拿出来

pull/6336/head
fghbng@qq.com 2021-06-03 11:01:11 +08:00 committed by Jiangjie.Bai
parent 53eb32e620
commit 3ae976c183
1 changed files with 9 additions and 3 deletions

View File

@ -72,11 +72,17 @@ class OrgResourceStatisticsRefreshUtil:
OrgResourceStatisticsCache(Organization.root()).expire(*cache_field_name)
@receiver(pre_save)
def on_post_save_refresh_org_resource_statistics_cache(sender, instance, **kwargs):
OrgResourceStatisticsRefreshUtil.refresh_if_need(instance)
@receiver(post_save)
def on_post_save_refresh_org_resource_statistics_cache(sender, instance, created, **kwargs):
if created:
OrgResourceStatisticsRefreshUtil.refresh_if_need(instance)
@receiver(pre_delete)
def on_pre_delete_refresh_org_resource_statistics_cache(sender, instance, **kwargs):
OrgResourceStatisticsRefreshUtil.refresh_if_need(instance)
@receiver(pre_save, sender=Session)
def on_session_changed_refresh_org_resource_statistics_cache(sender, instance, **kwargs):
OrgResourceStatisticsRefreshUtil.refresh_if_need(instance)