Skip to content

Commit

Permalink
Merge branch 'master' into migrate_to_clients_test_image
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 authored Nov 27, 2024
2 parents fbaf8a1 + d34b36e commit 859940f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ public class AccessControlLogEntry implements Serializable {
private final long timestampCreated;
private final long timestampLastUpdated;

/*
* Starting with Redis version 7.2.0: Added entry ID, timestamp created, and timestamp last updated.
* @see https://redis.io/docs/latest/commands/acl-log/
*/
public AccessControlLogEntry(Map<String, Object> map) {
count = (long) map.get(COUNT);
reason = (String) map.get(REASON);
Expand All @@ -51,9 +47,10 @@ public AccessControlLogEntry(Map<String, Object> map) {
ageSeconds = (Double) map.get(AGE_SECONDS);
clientInfo = getMapFromRawClientInfo((String) map.get(CLIENT_INFO));
logEntry = map;
entryId = map.get(ENTRY_ID) == null ? 0L : (long) map.get(ENTRY_ID);
timestampCreated = map.get(TIMESTAMP_CREATED) == null ? 0L : (long) map.get(TIMESTAMP_CREATED);
timestampLastUpdated = map.get(TIMESTAMP_LAST_UPDATED) == null ? 0L : (long) map.get(TIMESTAMP_LAST_UPDATED);
// Redis 7.2
entryId = map.containsKey(ENTRY_ID) ? (long) map.get(ENTRY_ID) : -1L;
timestampCreated = map.containsKey(TIMESTAMP_CREATED) ? (long) map.get(TIMESTAMP_CREATED) : -1L;
timestampLastUpdated = map.containsKey(TIMESTAMP_LAST_UPDATED) ? (long) map.get(TIMESTAMP_LAST_UPDATED) : -1L;
}

public long getCount() {
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/redis/clients/jedis/resps/CommandInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ public CommandInfo build(Object data) {
long firstKey = LONG.build(commandData.get(3));
long lastKey = LONG.build(commandData.get(4));
long step = LONG.build(commandData.get(5));
// (as of Redis 6.0)
List<String> aclCategories = commandData.size()>=6?STRING_LIST.build(commandData.get(6)): Collections.emptyList();

// (as of Redis 7.0)
List<String> tips = commandData.size()>=8?STRING_LIST.build(commandData.get(7)):Collections.emptyList();
Map<String, CommandInfo> subcommands = commandData.size()>=10?COMMAND_INFO_RESPONSE.build(commandData.get(9)):Collections.EMPTY_MAP;
// Redis 6.0
List<String> aclCategories = commandData.size() >= 7 ? STRING_LIST.build(commandData.get(6)) : null;
// Redis 7.0
List<String> tips = commandData.size() >= 8 ? STRING_LIST.build(commandData.get(7)) : null;
Map<String, CommandInfo> subcommands = commandData.size() >= 10
? COMMAND_INFO_RESPONSE.build(commandData.get(9)) : null;

return new CommandInfo(name, arity, flags, firstKey, lastKey, step, aclCategories, tips, subcommands);
}
Expand Down

0 comments on commit 859940f

Please sign in to comment.