
io.lettuce.core.output.KeyScanStreamingOutput Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lettuce-core Show documentation
Show all versions of lettuce-core Show documentation
Advanced and thread-safe Java Redis client for synchronous, asynchronous, and
reactive usage. Supports Cluster, Sentinel, Pipelining, Auto-Reconnect, Codecs
and much more.
The newest version!
package io.lettuce.core.output;
import java.nio.ByteBuffer;
import io.lettuce.core.StreamScanCursor;
import io.lettuce.core.codec.RedisCodec;
/**
* Streaming API for multiple Keys. You can implement this interface in order to receive a call to {@code onKey} on every key.
* Key uniqueness is not guaranteed.
*
* @param Key type.
* @param Value type.
* @author Mark Paluch
*/
public class KeyScanStreamingOutput extends ScanOutput {
private final KeyStreamingChannel channel;
public KeyScanStreamingOutput(RedisCodec codec, KeyStreamingChannel channel) {
super(codec, new StreamScanCursor());
this.channel = channel;
}
@Override
protected void setOutput(ByteBuffer bytes) {
channel.onKey(bytes == null ? null : codec.decodeKey(bytes));
output.setCount(output.getCount() + 1);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy