public abstract class AbstractClient extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static Charset |
DEFAULT_CHARSET |
| 构造器和说明 |
|---|
AbstractClient(Sharding sharding) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
关闭 SSDB 客户端
|
protected List<String> |
combineBlocks(List<Response> responseList) |
protected List<KeyValue> |
combineKeyValues(List<Response> responseList) |
Charset |
getCharset() |
Sharding |
getSharding()
获取负载均衡策略(可用于在运行时变更配置)
|
protected String[] |
prependCommand(String token,
List<String> parameterList)
将 token 插入到 parameters 的第一位,生成一个新的数组
|
protected String[] |
prependCommand(String token,
String[] parameters)
将 token 插入到 parameters 的第一位,生成一个新的数组
|
protected String[] |
prependCommand(String token1,
String token2,
List<String> parameters) |
protected String[] |
prependCommand(String token1,
String token2,
String[] parameters)
将两个 token 插入到 parameters 的第一位,生成一个新的数组
|
protected String[] |
prependCommandIdScore(String token1,
String token2,
List<IdScore> idScores) |
protected String[] |
prependCommandKeyValue(String token1,
String token2,
List<KeyValue> keyValues) |
Response |
sendRequest(Object... tokens)
发送命令,每个参数为命令的一部分,例如 "set", "key1", "value1"
|
Response |
sendRequest(Request request)
发送一个命令
|
Response |
sendRequest(Server server,
String command) |
Response |
sendRequest(String command)
发送一整条命令,例如 "set key1 value1"
|
protected List<Response> |
sendRequestToAll(Object... tokens) |
protected List<Response> |
sendRequestToAll(Request request) |
Response |
sendWriteRequest(Object... tokens)
发送包含写入操作的命令,每个参数为命令的一部分,例如 "set", "key1", "value1"
|
void |
setCharset(Charset charset) |
protected List<String[]> |
splitKeys(List<String> keys) |
protected List<String[]> |
splitKeys(String[] keys)
根据 Sharding 对 key 列表进行分组
|
protected List<List<KeyValue>> |
splitKeyValues(List<KeyValue> keyValues) |
protected List<String[]> |
splitKeyValues(String[] keyValues) |
public static final Charset DEFAULT_CHARSET
public AbstractClient(Sharding sharding)
public void setCharset(Charset charset)
public Charset getCharset()
public Sharding getSharding()
public Response sendRequest(String command)
command - 一整条命令public Response sendWriteRequest(Object... tokens)
tokens - 命令中的各个部分public Response sendRequest(Object... tokens)
tokens - 命令中的各个部分protected String[] prependCommand(String token, List<String> parameterList)
token - 要插入的内容parameterList - 参数protected String[] prependCommand(String token, String[] parameters)
token - 要插入的内容parameters - 参数protected String[] prependCommand(String token1, String token2, String[] parameters)
token1 - 要插入的内容token2 - 要插入的内容parameters - 参数protected String[] prependCommand(String token1, String token2, List<String> parameters)
protected String[] prependCommandKeyValue(String token1, String token2, List<KeyValue> keyValues)
protected String[] prependCommandIdScore(String token1, String token2, List<IdScore> idScores)
public void close()
protected List<String[]> splitKeys(String[] keys)
keys - 要进行分组的 key 列表Copyright © 2020. All rights reserved.