本文整理汇总了Java中redis.clients.jedis.SortingParams.getParams方法的典型用法代码示例。如果您正苦于以下问题:Java SortingParams.getParams方法的具体用法?Java SortingParams.getParams怎么用?Java SortingParams.getParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类redis.clients.jedis.SortingParams
的用法示例。
在下文中一共展示了SortingParams.getParams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sort
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public RedisValue<List<String>> sort(final CacheKey cacheKey, final String key, final SortingParams sortingParameters) {
Collection<byte[]> params = sortingParameters.getParams();
String[] paramList = new String[params.size() + 1];
paramList[0] = key;
int i = 1;
for (byte[] p : params) {
try {
paramList[i++] = new String(p, "UTF-8");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
final String localKey = concat("sort", paramList);
RedisValue<?> res = cacheWrapper.get(cacheKey, localKey, new Callable<RedisValue<?>>() {
@Override
public RedisValue<?> call() throws Exception {
return provider.sort(cacheKey, key, sortingParameters);
}
});
return (RedisValue<List<String>>) res;
}
示例2: sort
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
@Override
public RedisValue<List<String>> sort(final CacheKey cacheKey, final String key, final SortingParams sortingParameters) {
Collection<byte[]> params = sortingParameters.getParams();
String[] actualParams = new String[params.size() + 1];
actualParams[0] = key;
int i = 1;
for (byte[] p : params) {
try {
actualParams[i++] = new String(p, "UTF-8");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
concat("sort", actualParams);
RedisValue<List<String>> valueImpl = new RedisValue<List<String>>();
appendCommand(new PipelineCommand<List<String>>(valueImpl) {
@Override
public Response<List<String>> run() {
return ((RedisValue<List<String>>) pipelineProvider.sort(cacheKey, key, sortingParameters)).getResponse();
}
});
return valueImpl;
}
示例3: getSortingParamString
import redis.clients.jedis.SortingParams; //导入方法依赖的package包/类
private static String getSortingParamString(final SortingParams params) {
final StringBuilder builder = new StringBuilder();
for (final byte[] param: params.getParams()) {
builder.append(new String(param));
builder.append(" ");
}
return builder.toString().trim();
}