|
@@ -536,9 +536,9 @@ public class RedisUtils implements ApplicationContextAware {
|
|
String value = StringUtils.rjust(String.valueOf(random.nextInt(100000)), 5, '0');
|
|
String value = StringUtils.rjust(String.valueOf(random.nextInt(100000)), 5, '0');
|
|
long identity = Long.parseLong(time + value);
|
|
long identity = Long.parseLong(time + value);
|
|
byte[] key = (SEQUENCE_REDIS_PREFIX + identity).getBytes(StandardCharsets.UTF_8);
|
|
byte[] key = (SEQUENCE_REDIS_PREFIX + identity).getBytes(StandardCharsets.UTF_8);
|
|
- Boolean successful = execute(connection -> connection.set(key, ObjectUtils.EMPTY_BYTES,
|
|
|
|
|
|
+ Boolean success = execute(connection -> connection.set(key, ObjectUtils.EMPTY_BYTES,
|
|
Expiration.from(duration), RedisStringCommands.SetOption.SET_IF_ABSENT));
|
|
Expiration.from(duration), RedisStringCommands.SetOption.SET_IF_ABSENT));
|
|
- if (Boolean.TRUE.equals(successful)) {
|
|
|
|
|
|
+ if (Boolean.TRUE.equals(success)) {
|
|
return identity;
|
|
return identity;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -944,9 +944,9 @@ public class RedisUtils implements ApplicationContextAware {
|
|
for (int i = 0; i < 10; i++) {
|
|
for (int i = 0; i < 10; i++) {
|
|
String value = supplier.get();
|
|
String value = supplier.get();
|
|
byte[] key = (RANDOM_REDIS_PREFIX + value).getBytes(StandardCharsets.UTF_8);
|
|
byte[] key = (RANDOM_REDIS_PREFIX + value).getBytes(StandardCharsets.UTF_8);
|
|
- Boolean successful = execute(connection -> connection.set(key, ObjectUtils.EMPTY_BYTES,
|
|
|
|
|
|
+ Boolean success = execute(connection -> connection.set(key, ObjectUtils.EMPTY_BYTES,
|
|
Expiration.from(duration), RedisStringCommands.SetOption.SET_IF_ABSENT));
|
|
Expiration.from(duration), RedisStringCommands.SetOption.SET_IF_ABSENT));
|
|
- if (Boolean.TRUE.equals(successful)) {
|
|
|
|
|
|
+ if (Boolean.TRUE.equals(success)) {
|
|
return value;
|
|
return value;
|
|
}
|
|
}
|
|
}
|
|
}
|