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

org.redkalex.cache.redis.RedisCacheReqPing Maven / Gradle / Ivy

There is a newer version: 2.7.7
Show newest version
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.redkalex.cache.redis;

import java.nio.charset.StandardCharsets;
import org.redkale.net.client.ClientConnection;
import org.redkale.util.ByteArray;

/** @author zhangjx */
public class RedisCacheReqPing extends RedisCacheRequest {

    private static final byte[] BYTES = new ByteArray()
            .put((byte) '*')
            .put((byte) '1')
            .put((byte) '\r', (byte) '\n')
            .put((byte) '$')
            .put((byte) '4')
            .put((byte) '\r', (byte) '\n')
            .put("PING".getBytes(StandardCharsets.UTF_8))
            .put((byte) '\r', (byte) '\n')
            .getBytes();

    @Override
    public void writeTo(ClientConnection conn, ByteArray writer) {
        writer.put(BYTES);
    }

    @Override
    public String toString() {
        return getClass().getSimpleName() + "{PING}";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy