@Test public void zParams() { ZParams zParams = new ZParams().aggregate(ZParams.Aggregate.SUM); zParams.weights(1, 1); Collection<byte[]> collect = zParams.getParams(); System.out.println("######################"); for (byte[] b : collect) { System.out.println("collect :" + new String(b)); } System.out.println("######################"); }
@Test public void zinterstore2() { redis.zadd("zset1", 1, "one"); redis.zadd("zset1", 2, "two"); redis.zadd("zset2", 1, "one"); redis.zadd("zset2", 2, "two"); redis.zadd("zset2", 3, "three"); ZParams params = new ZParams().aggregate(ZParams.Aggregate.SUM); params.weights(2, 3); this.redis.zinterstore(key, params, "zset1", "zset2"); Set<Tuple> set = this.redis.zrangeWithScores(key, 0, -1); // Json.print(set, "set"); Assert.assertEquals("one,two", StringUtils.join(RedisUtil.tupleToString(set), ",")); Assert.assertEquals("5.0,10.0", StringUtils.join(RedisUtil.tupleToScores(set), ",")); }