Skip to content

Commit

Permalink
feat: support BatchAdapter (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
imp2002 authored Nov 16, 2022
1 parent bbe12d2 commit f310041
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/org/casbin/adapter/RedisAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.casbin.jcasbin.model.Assertion;
import org.casbin.jcasbin.model.Model;
import org.casbin.jcasbin.persist.Adapter;
import org.casbin.jcasbin.persist.BatchAdapter;
import org.casbin.jcasbin.persist.Helper;
import redis.clients.jedis.Jedis;

Expand All @@ -32,7 +33,7 @@
* @author shy
* @since 2021.04.13
*/
public class RedisAdapter implements Adapter {
public class RedisAdapter implements Adapter, BatchAdapter{
private String key;
private Jedis jedis;

Expand Down Expand Up @@ -109,6 +110,7 @@ public void removeFilteredPolicy(String sec, String ptype, int fieldIndex, Strin
/**
* AddPolicies adds policy rules to the storage.
*/
@Override
public void addPolicies(String sec, String ptype, List<List<String>> rules) {
for (List<String> rule:rules) {
addPolicy(sec, ptype, rule);
Expand All @@ -118,6 +120,7 @@ public void addPolicies(String sec, String ptype, List<List<String>> rules) {
/**
* RemovePolicies removes policy rules from the storage.
*/
@Override
public void removePolicies(String sec, String ptype, List<List<String>> rules) {
for (List<String> rule:rules) {
removePolicy(sec, ptype, rule);
Expand Down

0 comments on commit f310041

Please sign in to comment.