Skip to content

Commit

Permalink
fix: add missing Override functions in CachedEnforcer
Browse files Browse the repository at this point in the history
  • Loading branch information
sukidayou committed Dec 1, 2024
1 parent 8730ee3 commit 14ddc6b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/main/java/org/casbin/jcasbin/main/CachedEnforcer.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ public void loadPolicy() {
* @param params The parameters of the policy to be removed.
* @return True if the policy was removed, false otherwise.
*/
@Override
public boolean removePolicy(String... params){
if (enableCache.get()) {
String key = getKey(params);
String key = getKey((Object[]) params);
if (key != null) {
cache.delete(key);
}
Expand All @@ -193,6 +194,23 @@ public boolean removePolicies(List<List<String>> rules) {
return super.removePolicies(rules);
}

/**
* Removes multiple policies from the enforcer.
*
* @param rules The list of policies to be removed.
* @return True if the policies were removed, false otherwise.
*/
@Override
public boolean removePolicies(String[][] rules) {
if (rules != null && enableCache.get()) {
for (String[] rule : rules) {
String key = getKey((Object[]) rule);
cache.delete(key);
}
}
return super.removePolicies(rules);
}

/**
* Retrieves a cached result based on the key.
*
Expand Down

0 comments on commit 14ddc6b

Please sign in to comment.