- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中redis.clients.jedis.ZParams.weights()
方法的一些代码示例,展示了ZParams.weights()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZParams.weights()
方法的具体详情如下:
包路径:redis.clients.jedis.ZParams
类名称:ZParams
方法名:weights
[英]Set weights.
[中]
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public Long zInterStore(byte[] destKey, Aggregate aggregate, Weights weights, byte[]... sets) {
Assert.notNull(destKey, "Destination key must not be null!");
Assert.notNull(sets, "Source sets must not be null!");
Assert.noNullElements(sets, "Source sets must not contain null elements!");
Assert.isTrue(weights.size() == sets.length, () -> String
.format("The number of weights (%d) must match the number of source sets (%d)!", weights.size(), sets.length));
byte[][] allKeys = ByteUtils.mergeArrays(destKey, sets);
if (ClusterSlotHashUtil.isSameSlotForAllKeys(allKeys)) {
ZParams zparams = new ZParams().weights(weights.toArray()).aggregate(ZParams.Aggregate.valueOf(aggregate.name()));
try {
return connection.getCluster().zinterstore(destKey, zparams, sets);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
throw new IllegalArgumentException("ZINTERSTORE can only be executed when all keys map to the same slot");
}
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public Long zUnionStore(byte[] destKey, Aggregate aggregate, Weights weights, byte[]... sets) {
Assert.notNull(destKey, "Destination key must not be null!");
Assert.notNull(sets, "Source sets must not be null!");
Assert.noNullElements(sets, "Source sets must not contain null elements!");
Assert.isTrue(weights.size() == sets.length, () -> String
.format("The number of weights (%d) must match the number of source sets (%d)!", weights.size(), sets.length));
byte[][] allKeys = ByteUtils.mergeArrays(destKey, sets);
if (ClusterSlotHashUtil.isSameSlotForAllKeys(allKeys)) {
ZParams zparams = new ZParams().weights(weights.toArray()).aggregate(ZParams.Aggregate.valueOf(aggregate.name()));
try {
return connection.getCluster().zunionstore(destKey, zparams, sets);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
throw new InvalidDataAccessApiUsageException("ZUNIONSTORE can only be executed when all keys map to the same slot");
}
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public Long zUnionStore(byte[] destKey, Aggregate aggregate, Weights weights, byte[]... sets) {
Assert.notNull(destKey, "Destination key must not be null!");
Assert.notNull(sets, "Source sets must not be null!");
Assert.notNull(weights, "Weights must not be null!");
Assert.noNullElements(sets, "Source sets must not contain null elements!");
Assert.isTrue(weights.size() == sets.length, () -> String
.format("The number of weights (%d) must match the number of source sets (%d)!", weights.size(), sets.length));
try {
ZParams zparams = new ZParams().weights(weights.toArray()).aggregate(ZParams.Aggregate.valueOf(aggregate.name()));
if (isPipelined()) {
pipeline(connection.newJedisResult(connection.getRequiredPipeline().zunionstore(destKey, zparams, sets)));
return null;
}
if (isQueueing()) {
transaction(connection.newJedisResult(connection.getRequiredTransaction().zunionstore(destKey, zparams, sets)));
return null;
}
return connection.getJedis().zunionstore(destKey, zparams, sets);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public Long zInterStore(byte[] destKey, Aggregate aggregate, Weights weights, byte[]... sets) {
Assert.notNull(destKey, "Destination key must not be null!");
Assert.notNull(sets, "Source sets must not be null!");
Assert.noNullElements(sets, "Source sets must not contain null elements!");
Assert.isTrue(weights.size() == sets.length, () -> String
.format("The number of weights (%d) must match the number of source sets (%d)!", weights.size(), sets.length));
try {
ZParams zparams = new ZParams().weights(weights.toArray()).aggregate(ZParams.Aggregate.valueOf(aggregate.name()));
if (isPipelined()) {
pipeline(connection.newJedisResult(connection.getRequiredPipeline().zinterstore(destKey, zparams, sets)));
return null;
}
if (isQueueing()) {
transaction(connection.newJedisResult(connection.getRequiredTransaction().zinterstore(destKey, zparams, sets)));
return null;
}
return connection.getJedis().zinterstore(destKey, zparams, sets);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
代码示例来源:origin: mindwind/craft-atom
@SuppressWarnings("deprecation")
private Long zunionstore_weights(Jedis j, String destination, Map<String, Integer> weightkeys) {
Object[] objs = convert4zstore(weightkeys);
String[] keys = (String[]) objs[0];
int [] weights = (int[]) objs[1];
return j.zunionstore(destination, new ZParams().weights(weights), keys);
}
代码示例来源:origin: io.leopard/leopard-redis
@SuppressWarnings("deprecation")
@Override
public Long zinterstore(String dstkey, String... sets) {
int[] weights = new int[sets.length];
for (int i = 0; i < sets.length; i++) {
weights[i] = 1;
}
ZParams params = new ZParams().aggregate(ZParams.Aggregate.SUM);
params.weights(weights);
return zinterstore(dstkey, params, sets);
}
代码示例来源:origin: mindwind/craft-atom
@SuppressWarnings("deprecation")
private Long zinterstore_weights(Jedis j, String destination, Map<String, Integer> weightkeys) {
Object[] objs = convert4zstore(weightkeys);
String[] keys = (String[]) objs[0];
int [] weights = (int[]) objs[1];
return j.zinterstore(destination, new ZParams().weights(weights), keys);
}
代码示例来源:origin: mindwind/craft-atom
@SuppressWarnings("deprecation")
private void zinterstore_weights(String destination, Map<String, Integer> weightkeys) {
Object[] objs = convert4zstore(weightkeys);
String[] keys = (String[]) objs[0];
int [] weights = (int[]) objs[1];
t.zinterstore(destination, new ZParams().weights(weights), keys);
}
代码示例来源:origin: mindwind/craft-atom
@SuppressWarnings("deprecation")
private void zunionstore_weights(String destination, Map<String, Integer> weightkeys) {
Object[] objs = convert4zstore(weightkeys);
String[] keys = (String[]) objs[0];
int [] weights = (int[]) objs[1];
t.zunionstore(destination, new ZParams().weights(weights), keys);
}
代码示例来源:origin: mindwind/craft-atom
@SuppressWarnings("deprecation")
private Long zinterstore_weights_max(Jedis j, String destination, Map<String, Integer> weightkeys) {
Object[] objs = convert4zstore(weightkeys);
String[] keys = (String[]) objs[0];
int [] weights = (int[]) objs[1];
return j.zinterstore(destination, new ZParams().weights(weights).aggregate(Aggregate.MAX), keys);
}
代码示例来源:origin: mindwind/craft-atom
@SuppressWarnings("deprecation")
private void zinterstore_weights_max(String destination, Map<String, Integer> weightkeys) {
Object[] objs = convert4zstore(weightkeys);
String[] keys = (String[]) objs[0];
int [] weights = (int[]) objs[1];
t.zinterstore(destination, new ZParams().weights(weights).aggregate(Aggregate.MAX), keys);
}
代码示例来源:origin: mindwind/craft-atom
@SuppressWarnings("deprecation")
private void zunionstore_weights_max(String destination, Map<String, Integer> weightkeys) {
Object[] objs = convert4zstore(weightkeys);
String[] keys = (String[]) objs[0];
int [] weights = (int[]) objs[1];
t.zunionstore(destination, new ZParams().weights(weights).aggregate(Aggregate.MAX), keys);
}
代码示例来源:origin: mindwind/craft-atom
@SuppressWarnings("deprecation")
private Long zinterstore_weights_min(Jedis j, String destination, Map<String, Integer> weightkeys) {
Object[] objs = convert4zstore(weightkeys);
String[] keys = (String[]) objs[0];
int [] weights = (int[]) objs[1];
return j.zinterstore(destination, new ZParams().weights(weights).aggregate(Aggregate.MIN), keys);
}
代码示例来源:origin: mindwind/craft-atom
@SuppressWarnings("deprecation")
private Long zunionstore_weights_max(Jedis j, String destination, Map<String, Integer> weightkeys) {
Object[] objs = convert4zstore(weightkeys);
String[] keys = (String[]) objs[0];
int [] weights = (int[]) objs[1];
return j.zunionstore(destination, new ZParams().weights(weights).aggregate(Aggregate.MAX), keys);
}
代码示例来源:origin: mindwind/craft-atom
@SuppressWarnings("deprecation")
private Long zunionstore_weights_min(Jedis j, String destination, Map<String, Integer> weightkeys) {
Object[] objs = convert4zstore(weightkeys);
String[] keys = (String[]) objs[0];
int [] weights = (int[]) objs[1];
return j.zunionstore(destination, new ZParams().weights(weights).aggregate(Aggregate.MIN), keys);
}
代码示例来源:origin: mindwind/craft-atom
@SuppressWarnings("deprecation")
private void zinterstore_weights_min(String destination, Map<String, Integer> weightkeys) {
Object[] objs = convert4zstore(weightkeys);
String[] keys = (String[]) objs[0];
int [] weights = (int[]) objs[1];
t.zinterstore(destination, new ZParams().weights(weights).aggregate(Aggregate.MIN), keys);
}
代码示例来源:origin: mindwind/craft-atom
@SuppressWarnings("deprecation")
private void zunionstore_weights_min(String destination, Map<String, Integer> weightkeys) {
Object[] objs = convert4zstore(weightkeys);
String[] keys = (String[]) objs[0];
int [] weights = (int[]) objs[1];
t.zunionstore(destination, new ZParams().weights(weights).aggregate(Aggregate.MIN), keys);
}
代码示例来源:origin: chenjunwen/SpringBootFrame
/**
* 计算有序集合相加减(socre值)
*
* @param dstkey
* @param weights
* @param sets
* @return
*/
@SuppressWarnings("deprecation")
public Long zinterstore(String dstkey, int[] weights, String... sets) {
Jedis jedis = null;
Long res = null;
try {
jedis = pool.getResource();
if (weights == null) {
res = jedis.zinterstore(dstkey, sets);
} else {
ZParams zParams = new ZParams();
zParams.aggregate(ZParams.Aggregate.SUM);
zParams.weights(weights);
res = jedis.zinterstore(dstkey, zParams, sets);
}
} catch (Exception e) {
LOGGER.error(e.getMessage());
} finally {
returnResource(pool, jedis);
}
return res;
}
我有一个 tomcat 服务器并使用 jedis 客户端连接到它。 我使用的jedis版本是“3.0.0-m1”,tomcat 8.0.15 连接后几个小时后,我看到以下异常。有什么帮助吗? redi
我正在使用 Jedis 连接到 Redis 并将数据推送到列表中。我正在为 JSON 数据使用 rpush。 这些是我执行的步骤: 从 Rabbitmq 获取数据 从 JSON 数据中收集信息并准备一
我正在尝试在 vim 中使用 python-jedi,但目前它完全无法使用,因为它试图在奇怪的时间完成代码。 我添加了以下行: let g:jedi#popup_on_dot = 0 到我的 vim
我正在使用 jedi-vim,输入以下内容后,出现“未找到模式”错误: import numpy numpy. 但是,如果我运行以下 python 脚本,我会得到一长串完成列表: import jed
以下 Java 代码将一百万对整数插入到 Redis 中。 public class JedisInsertion { public static byte[] fromInt(in
我在几个线程中看到了答案,但没有解决我的问题,因为我的问题偶尔会出现,如果有人有任何想法,请问这个问题。 我使用的是jedis 2.8.0版本,Spring Data redis 1.7.5版本。和用
我的 Storm 类使用 Redis 队列来收集数据。 我尝试运行我的 Storm jar storm jar jar_file_name.jar Topology_name configuratio
我通过 jedis 在 java 上有这段代码: int shb1 = jds.storeHypnoBeats(id1, arr1); 调用这个函数: int storeHypnoBeats(Stri
我是 jedi-vim 的新手,我不知道如何跳转其他文件中的函数定义。 jedi-vim 's doc是: 以下是其中的一部分: NOTE: subject to change! let g:jedi
我刚刚注意到,每当我对任何 Delphi 2010 项目进行增量编译 (ctrl-F9) 时,我的项目中引用的所有 JEDI 单元都会重新编译,尽管它们没有以任何方式进行更改。事实上,如果我创建一个新
我正在使用 Jedi usb hid 组件连接 HID 设备并对其进行读取和写入。我无法写入设备。我一直在使用这个代码。 type TReport = Packed record ReportID:
我正在使用 Jedis,我无法直接连接到 Redis,我必须使用代理。我可以使用 socks 代理通过 Jedis 连接到 Redis 吗? 请你帮帮我。 问候。 最佳答案 我一直在寻找解决方案,但找
我在 vim 中通过 YCM 使用 jedi,在我的项目中看到一些奇怪的行为,关于在 jediHttp 服务器上使用 usages 端点。基本上它只能找到我项目中类或函数的一小部分用法。它确实找到了当
我正在尝试连接到我的虚拟机 Redis package nosql; import redis.clients.jedis.Jedis; public class NoSQL { public sta
我在我用作生产者/消费者队列的 Redis 队列之上使用 Java 库 Jedis。它易于设置并且运行良好。 消费者代码如下 List messages = jedis.blpop(0, redisQ
什么是jedis事务执行成功响应? jedis 似乎会返回 1 作为成功响应。如果交易包括两个操作,我的以下代码是否有效? List ret = jedisAdapter.exec(tx, jedi
我在看jedis源码的时候发现 connection = connectionHandler.getConnectionFromSlot(JedisClusterCRC16.getSlot(key))
我在 jedis 客户端的帮助下使用 redis。在此处附加键值设置/获取的代码片段。在这里,我希望我的 jedisPool 只被初始化一次,但它被初始化了多次。不知道我哪里错了。用它挠我的头几天。我
当我像下面的代码一样使用 jedis 时: public class JedisTest extends Sync { private static final String _SET_KEY
我最近不得不使用 Jedis 库,它是一个很棒的库。我知道 Redis 是用 C 编写的,Jedis 只是将 Java 包装在 C 周围吗?光看Jedis源码是想不通的。谁能解释一下? 最佳答案 Je
我是一名优秀的程序员,十分优秀!