All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.lettuce.core.output.ValueScanStreamingOutput Maven / Gradle / Ivy

Go to download

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 Values. You can implement this interface in order to receive a call to {@code onValue} on every
 * key.
 *
 * @param  Key type.
 * @param  Value type.
 * @author Mark Paluch
 */
public class ValueScanStreamingOutput extends ScanOutput {

    private final ValueStreamingChannel channel;

    public ValueScanStreamingOutput(RedisCodec codec, ValueStreamingChannel channel) {
        super(codec, new StreamScanCursor());
        this.channel = channel;
    }

    @Override
    protected void setOutput(ByteBuffer bytes) {
        channel.onValue(bytes == null ? null : codec.decodeValue(bytes));
        output.setCount(output.getCount() + 1);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy