mirror of
https://github.com/ColdeZhang/Dominion.git
synced 2025-02-04 22:49:41 +08:00
优化成员权限缓存更新加载策略,提高效率
This commit is contained in:
parent
278ce8a686
commit
723ac794fe
@ -111,12 +111,16 @@ public class Cache {
|
||||
private void loadPlayerPrivilegesExecution(UUID player_to_update) {
|
||||
Scheduler.runTaskAsync(() -> {
|
||||
long start = System.currentTimeMillis();
|
||||
List<PlayerPrivilegeDTO> all_privileges = new ArrayList<>();
|
||||
List<PlayerPrivilegeDTO> all_privileges;
|
||||
if (player_to_update == null) {
|
||||
all_privileges = PlayerPrivilegeDTO.selectAll();
|
||||
player_uuid_to_privilege = new ConcurrentHashMap<>();
|
||||
} else {
|
||||
all_privileges = PlayerPrivilegeDTO.selectAll(player_to_update);
|
||||
if (!player_uuid_to_privilege.containsKey(player_to_update)) {
|
||||
player_uuid_to_privilege.put(player_to_update, new ConcurrentHashMap<>());
|
||||
}
|
||||
player_uuid_to_privilege.get(player_to_update).clear();
|
||||
}
|
||||
for (PlayerPrivilegeDTO privilege : all_privileges) {
|
||||
UUID player_uuid = privilege.getPlayerUUID();
|
||||
|
Loading…
Reference in New Issue
Block a user