同步:redkale 升级

This commit is contained in:
2023-10-25 17:50:31 +08:00
parent 747b165e77
commit 2e0d9af014
21 changed files with 1783 additions and 1546 deletions

View File

@@ -11,11 +11,12 @@ import org.redkale.util.ByteArray;
import java.nio.charset.StandardCharsets;
/**
*
* @author zhangjx
*/
public class RedisCacheReqAuth extends RedisCacheRequest {
private static final byte[] PS = "AUTH".getBytes(StandardCharsets.UTF_8);
private static final byte[] PS = "AUTH\r\n".getBytes(StandardCharsets.UTF_8);
protected String password;
@@ -26,20 +27,18 @@ public class RedisCacheReqAuth extends RedisCacheRequest {
@Override
public void writeTo(ClientConnection conn, ByteArray writer) {
byte[] pwd = password.getBytes();
writer.put((byte) '*');
writer.put((byte) '2');
writer.put((byte) '\r', (byte) '\n');
writer.put((byte) '$');
writer.put((byte) '4');
writer.put((byte) '\r', (byte) '\n');
writer.put(mutliLengthBytes(2));
writer.put(bulkLengthBytes(4));
writer.put(PS);
writer.put((byte) '\r', (byte) '\n');
writer.put((byte) '$');
writer.put(String.valueOf(pwd.length).getBytes(StandardCharsets.UTF_8));
writer.put((byte) '\r', (byte) '\n');
writer.put(bulkLengthBytes(pwd.length));
writer.put(pwd);
writer.put((byte) '\r', (byte) '\n');
writer.put(CRLF);
}
@Override
public String toString() {
return getClass().getSimpleName() + "{AUTH " + password + "}";
}
}