mirror of https://github.com/jumpserver/jumpserver
优化缓存,将会话的缓存拿出来
parent
53eb32e620
commit
3ae976c183
|
@ -72,11 +72,17 @@ class OrgResourceStatisticsRefreshUtil:
|
||||||
OrgResourceStatisticsCache(Organization.root()).expire(*cache_field_name)
|
OrgResourceStatisticsCache(Organization.root()).expire(*cache_field_name)
|
||||||
|
|
||||||
|
|
||||||
@receiver(pre_save)
|
@receiver(post_save)
|
||||||
def on_post_save_refresh_org_resource_statistics_cache(sender, instance, **kwargs):
|
def on_post_save_refresh_org_resource_statistics_cache(sender, instance, created, **kwargs):
|
||||||
OrgResourceStatisticsRefreshUtil.refresh_if_need(instance)
|
if created:
|
||||||
|
OrgResourceStatisticsRefreshUtil.refresh_if_need(instance)
|
||||||
|
|
||||||
|
|
||||||
@receiver(pre_delete)
|
@receiver(pre_delete)
|
||||||
def on_pre_delete_refresh_org_resource_statistics_cache(sender, instance, **kwargs):
|
def on_pre_delete_refresh_org_resource_statistics_cache(sender, instance, **kwargs):
|
||||||
OrgResourceStatisticsRefreshUtil.refresh_if_need(instance)
|
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…
Reference in New Issue