修改:工程结构变更为 maven 工程

This commit is contained in:
2023-06-25 02:21:32 +08:00
parent c0a1c60cb6
commit bdeb961002
40 changed files with 77 additions and 13 deletions

View File

@@ -0,0 +1,45 @@
/*
* 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 org.redkale.net.client.ClientConnection;
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);
protected String password;
public RedisCacheReqAuth(String password) {
this.password = password;
}
@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(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(pwd);
writer.put((byte) '\r', (byte) '\n');
}
}