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

io.lettuce.core.output.KeyStreamingOutput 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.codec.RedisCodec;

/**
 * Streaming-Output of Keys. Returns the count of all keys (including null).
 *
 * @param  Key type.
 * @param  Value type.
 * @author Mark Paluch
 */
public class KeyStreamingOutput extends CommandOutput {

    private final KeyStreamingChannel channel;

    public KeyStreamingOutput(RedisCodec codec, KeyStreamingChannel channel) {
        super(codec, Long.valueOf(0));
        this.channel = channel;
    }

    @Override
    public void set(ByteBuffer bytes) {

        channel.onKey(bytes == null ? null : codec.decodeKey(bytes));
        output = output.longValue() + 1;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy