-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename to allow/deny instead of white/black
- Loading branch information
Showing
3 changed files
with
43 additions
and
44 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/main/java/redis/clients/jedis/csc/util/AllowAndDenyListWithStringKeys.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package redis.clients.jedis.csc.util; | ||
|
||
import java.util.Set; | ||
import redis.clients.jedis.commands.ProtocolCommand; | ||
import redis.clients.jedis.csc.ClientSideCacheable; | ||
|
||
public class AllowAndDenyListWithStringKeys implements ClientSideCacheable { | ||
|
||
private final Set<ProtocolCommand> allowCommands; | ||
private final Set<ProtocolCommand> denyCommands; | ||
|
||
private final Set<String> allowKeys; | ||
private final Set<String> denyKeys; | ||
|
||
public AllowAndDenyListWithStringKeys(Set<ProtocolCommand> allowCommands, Set<ProtocolCommand> denyCommands, | ||
Set<String> allowKeys, Set<String> denyKeys) { | ||
this.allowCommands = allowCommands; | ||
this.denyCommands = denyCommands; | ||
this.allowKeys = allowKeys; | ||
this.denyKeys = denyKeys; | ||
} | ||
|
||
@Override | ||
public boolean isCacheable(ProtocolCommand command, Object... keys) { | ||
if (allowCommands != null && !allowCommands.contains(command)) return false; | ||
if (denyCommands != null && denyCommands.contains(command)) return false; | ||
|
||
for (Object key : keys) { | ||
if (!(key instanceof String)) return false; | ||
if (allowKeys != null && !allowKeys.contains((String) key)) return false; | ||
if (denyKeys != null && denyKeys.contains((String) key)) return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
37 changes: 0 additions & 37 deletions
37
src/main/java/redis/clients/jedis/csc/util/StringWhiteListBlackListClientSideCacheable.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters