mirror of https://github.com/jumpserver/jumpserver
perf: 优化 UserPermTreeExprireUtil
parent
89f89532e7
commit
5e5061a825
|
@ -114,13 +114,6 @@ class UserPermTreeExpireUtil(UserPermTreeCacheMixin):
|
|||
def cache_key_all_user(self):
|
||||
return self.get_cache_key('*')
|
||||
|
||||
def expire_perm_tree_for_all_user(self):
|
||||
keys = self.client.keys(self.cache_key_all_user)
|
||||
with self.client.pipline() as p:
|
||||
for k in keys:
|
||||
p.delete(k)
|
||||
p.execute()
|
||||
|
||||
def expire_perm_tree_for_nodes_assets(self, node_ids, asset_ids):
|
||||
node_perm_ids = AssetPermissionUtil().get_permissions_for_nodes(node_ids, flat=True)
|
||||
asset_perm_ids = AssetPermissionUtil().get_permissions_for_assets(asset_ids, flat=True)
|
||||
|
@ -158,6 +151,14 @@ class UserPermTreeExpireUtil(UserPermTreeCacheMixin):
|
|||
p.execute()
|
||||
logger.info('Expire perm tree for users: [{}], orgs: [{}]'.format(user_ids, org_ids))
|
||||
|
||||
def expire_perm_tree_for_all_user(self):
|
||||
keys = self.client.keys(self.cache_key_all_user)
|
||||
with self.client.pipline() as p:
|
||||
for k in keys:
|
||||
p.delete(k)
|
||||
p.execute()
|
||||
logger.info('Expire all user perm tree')
|
||||
|
||||
|
||||
class UserGrantedUtilsBase:
|
||||
user: User
|
||||
|
|
Loading…
Reference in New Issue