Browse Source

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

pull/6336/head
fghbng@qq.com 4 years ago committed by Jiangjie.Bai
parent
commit
3ae976c183
  1. 12
      apps/orgs/signals_handler/cache.py

12
apps/orgs/signals_handler/cache.py

@ -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)

Loading…
Cancel
Save