移除~近似裁剪选项,替换成高级API调用
This commit is contained in:
@@ -81,11 +81,11 @@ public class StreamTrimScheduler implements SmartLifecycle {
|
|||||||
long maxlen = props.getTrim().getMaxlen();
|
long maxlen = props.getTrim().getMaxlen();
|
||||||
for (String stream : distinctStreams()) {
|
for (String stream : distinctStreams()) {
|
||||||
try {
|
try {
|
||||||
redis.execute((RedisCallback<Object>) connection -> connection.execute("XTRIM",
|
redis.opsForStream().trim(stream,maxlen);
|
||||||
stream.getBytes(StandardCharsets.UTF_8),
|
// redis.execute((RedisCallback<Object>) connection -> connection.execute("XTRIM",
|
||||||
"MAXLEN".getBytes(StandardCharsets.UTF_8),
|
// stream.getBytes(StandardCharsets.UTF_8),
|
||||||
"~".getBytes(StandardCharsets.UTF_8),
|
// "MAXLEN".getBytes(StandardCharsets.UTF_8),
|
||||||
String.valueOf(maxlen).getBytes(StandardCharsets.UTF_8)));
|
// String.valueOf(maxlen).getBytes(StandardCharsets.UTF_8)));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("[redis-stream] trim failed stream={}", stream, e);
|
log.warn("[redis-stream] trim failed stream={}", stream, e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user