Cache calls querying parent groups in bridge subjects - closes #69

This commit is contained in:
Luck
2016-12-18 09:57:39 +00:00
Unverified
parent d9d01e09aa
commit 4857969ca4
2 changed files with 55 additions and 18 deletions
@@ -116,6 +116,9 @@ public abstract class PermissionHolder {
@Getter
private final Lock ioLock = new ReentrantLock();
@Getter
private final Set<Runnable> stateListeners = ConcurrentHashMap.newKeySet();
/*
* CACHES - cache the result of a number of methods in this class, until they are invalidated.
@@ -178,6 +181,15 @@ public abstract class PermissionHolder {
getAllNodesFilteredCache.invalidateAll();
exportNodesCache.invalidateAll();
// Invalidate listeners
for (Runnable r : stateListeners) {
try {
r.run();
} catch (Exception e) {
e.printStackTrace();
}
}
// Get previous references
Set<HolderReference> refs = plugin.getCachedStateManager().getInheritances(toReference());