Cache regex permissions when they get processed

This commit is contained in:
Luck 2017-01-12 19:45:15 +00:00
parent ced3e6959c
commit a1afc70bcb
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 5 additions and 1 deletions

View File

@ -57,7 +57,10 @@ public class RegexProcessor implements PermissionProcessor {
continue;
}
regexPermissions.put(e.getKey().substring(2), e.getValue());
String pattern = e.getKey().substring(2);
Patterns.compile(pattern); // Cache the lookup for later.
regexPermissions.put(pattern, e.getValue());
}
}
}

View File

@ -61,6 +61,7 @@ public class Patterns {
try {
return CACHE.get(regex);
} catch (UncheckedExecutionException | ExecutionException e) {
e.printStackTrace();
return null;
}
}