本文整理汇总了Java中redis.clients.jedis.Tuple类的典型用法代码示例。如果您正苦于以下问题:Java Tuple类的具体用法?Java Tuple怎么用?Java Tuple使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Tuple类属于redis.clients.jedis包,在下文中一共展示了Tuple类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setValue
import redis.clients.jedis.Tuple; //导入依赖的package包/类
/**
* 装载面板数据.
*
* @param key 数据库中的键
*/
@Override
public void setValue(String key) {
ObservableList<TableEntity> values = FXCollections.observableArrayList();
Set<Tuple> sets = redisZset.getMemberSetWithScore(key);
int i = 0;
for (Tuple set : sets) {
TableEntity value = new TableEntity("" + i, set.getElement(), "" + set.getScore());
values.add(value);
i++;
}
this.dataTable.setItems(values);
this.rowColumn.setCellValueFactory(cellData -> cellData.getValue().rowProperty());
this.keyColumn.setCellValueFactory(cellData -> cellData.getValue().keyProperty());
this.valueColumn.setCellValueFactory(cellData -> cellData.getValue().valueProperty());
}
示例2: queryRank
import redis.clients.jedis.Tuple; //导入依赖的package包/类
public List<CrossRank> queryRank(int rankType, int start, int end) {
List<CrossRank> ranks = new ArrayList<>();
Set<Tuple> tupleSet = cluster.zrevrangeWithScores("CrossRank_" + rankType, start , end );
Class<? extends AbstractCrossRank> rankClazz = rank2Class.get(rankType);
for (Tuple record:tupleSet) {
try{
String element = record.getElement();
AbstractCrossRank rankProto = rankClazz.newInstance();
String resultKey = rankProto.buildResultKey();
String data = cluster.hget(resultKey, element);
CrossRank rank = unserialize(data, rankClazz);
ranks.add(rank);
}catch(Exception e) {
e.printStackTrace();
}
}
return ranks;
}
示例3: zAllMemberWithScore
import redis.clients.jedis.Tuple; //导入依赖的package包/类
/**
* 获取所有成员及分数
*
* @param key
*/
public Set<Tuple> zAllMemberWithScore(String key) {
Jedis jedis = null;
boolean success = true;
Set<Tuple> set = null;
try {
jedis = jedisPool.getResource();
if (jedis == null) {
success = false;
return set;
}
set = jedis.zrevrangeWithScores(key, 0, -1);
} catch (Exception e) {
success = false;
releaseBrokenReidsSource(jedis, key, "zAllMemberWithScore", e, false);
} finally {
releaseReidsSource(success, jedis);
}
return set;
}
示例4: zrevrangeByScoreWithScores
import redis.clients.jedis.Tuple; //导入依赖的package包/类
@Override
public Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min) {
Span span = helper.buildSpan("zrevrangeByScoreWithScores", key);
span.setTag("min", min);
span.setTag("max", max);
try {
return super.zrevrangeByScoreWithScores(key, max, min);
} catch (Exception e) {
onError(e, span);
throw e;
} finally {
span.finish();
}
}
示例5: zscan
import redis.clients.jedis.Tuple; //导入依赖的package包/类
@Test
public void zscan() {
jedis.zadd("foo", 1, "a");
jedis.zadd("foo", 2, "b");
ScanResult<Tuple> result = jedis.zscan("foo", SCAN_POINTER_START);
assertEquals(SCAN_POINTER_START, result.getStringCursor());
assertFalse(result.getResult().isEmpty());
// binary
jedis.zadd(bfoo, 1, ba);
jedis.zadd(bfoo, 1, bb);
ScanResult<Tuple> bResult = jedis.zscan(bfoo, SCAN_POINTER_START_BINARY);
assertArrayEquals(SCAN_POINTER_START_BINARY, bResult.getCursorAsBytes());
assertFalse(bResult.getResult().isEmpty());
}
示例6: getIdsByRedis
import redis.clients.jedis.Tuple; //导入依赖的package包/类
private Pager<Integer> getIdsByRedis(String key,double max,double min, int offset, int row) {
Pager<Integer> pager = new Pager<Integer>();
List<Integer> lists = new ArrayList<Integer>();
Jedis redis = jedisPool.getResource();
Set<Tuple> setCount = redis.zrevrangeByScoreWithScores(key, max, min);
int count = setCount.size();
pager.setRows(count);
if(count <= 0)
return pager;
Set<Tuple> set = redis.zrevrangeByScoreWithScores(key, max, min, offset, row);
Iterator<Tuple> it = set.iterator();
Tuple t =null;
while (it.hasNext()) {
t = it.next();
lists.add(Integer.parseInt(t.getElement()));
}
pager.setResult(lists);
return pager;
}
示例7: zrangeByScoreWithScores
import redis.clients.jedis.Tuple; //导入依赖的package包/类
@Override
public Set<Tuple> zrangeByScoreWithScores(String key, double min, double max, int offset,
int count) {
Span span = helper.buildSpan("zrangeByScoreWithScores", key);
span.setTag("min", min);
span.setTag("max", max);
span.setTag("offset", offset);
span.setTag("count", count);
try {
return super.zrangeByScoreWithScores(key, min, max, offset, count);
} catch (Exception e) {
onError(e, span);
throw e;
} finally {
span.finish();
}
}
示例8: zrevrangeByScoreWithScores
import redis.clients.jedis.Tuple; //导入依赖的package包/类
@Override
public Set<Tuple> zrevrangeByScoreWithScores(byte[] key, double max, double min, int offset,
int count) {
Span span = helper.buildSpan("zrevrangeByScoreWithScores", key);
span.setTag("min", min);
span.setTag("max", max);
span.setTag("offset", offset);
span.setTag("count", count);
try {
return super.zrevrangeByScoreWithScores(key, max, min, offset, count);
} catch (Exception e) {
onError(e, span);
throw e;
} finally {
span.finish();
}
}
示例9: zrangeByScoreWithScores
import redis.clients.jedis.Tuple; //导入依赖的package包/类
@Override
public Set<Tuple> zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max, int offset,
int count) {
Span span = helper.buildSpan("zrangeByScoreWithScores", key);
span.setTag("min", Arrays.toString(min));
span.setTag("max", Arrays.toString(max));
span.setTag("offset", offset);
span.setTag("count", count);
try {
return super.zrangeByScoreWithScores(key, min, max, offset, count);
} catch (Exception e) {
onError(e, span);
throw e;
} finally {
span.finish();
}
}
示例10: show
import redis.clients.jedis.Tuple; //导入依赖的package包/类
private void show(){
Set<Tuple> sets = redisSortSet.getMemberSetWithScore(key);
for(Tuple k:sets){
System.out.println(k.getElement()+" : "+k.getScore());
}
redisSortSet.deleteKey(key);
}
示例11: zscan
import redis.clients.jedis.Tuple; //导入依赖的package包/类
@Override
public ScanResult<Tuple> zscan(byte[] key, byte[] cursor, ScanParams params) {
Span span = helper.buildSpan("zscan", key);
span.setTag("cursor", Arrays.toString(cursor));
span.setTag("params", TracingHelper.toString(params.getParams()));
try {
return super.zscan(key, cursor, params);
} catch (Exception e) {
onError(e, span);
throw e;
} finally {
span.finish();
}
}
示例12: zscan
import redis.clients.jedis.Tuple; //导入依赖的package包/类
@Override
public ScanResult<Tuple> zscan(String key, int cursor) {
Span span = helper.buildSpan("zscan", key);
span.setTag("cursor", cursor);
try {
return super.zscan(key, cursor);
} catch (Exception e) {
onError(e, span);
throw e;
} finally {
span.finish();
}
}
示例13: zrevrangeByScoreWithScores
import redis.clients.jedis.Tuple; //导入依赖的package包/类
/**
* zrevrangeByScoreWithScores
*
* @param key specified key
* @param max max value
* @param min min value
* @return Multi bulk reply specifically a list of elements in the specified score range.
*/
@Override
public Set<Tuple> zrevrangeByScoreWithScores(final String bizkey,final String nameSpace, final double max, final double min) {
final String key = CacheUtils.getKeyByNamespace(bizkey,nameSpace);
return this.performFunction(key, new CallBack<Set<Tuple>>() {
public Set<Tuple> invoke(Jedis jedis) {
return jedis.zrevrangeByScoreWithScores(key, max, min);
}
});
}
示例14: zrevrangeWithScores
import redis.clients.jedis.Tuple; //导入依赖的package包/类
@Override
public Set<Tuple> zrevrangeWithScores(String key, long start, long end) {
Span span = helper.buildSpan("zrevrangeWithScores", key);
span.setTag("start", start);
span.setTag("end", end);
try {
return super.zrevrangeWithScores(key, start, end);
} catch (Exception e) {
onError(e, span);
throw e;
} finally {
span.finish();
}
}
示例15: zrevrangeWithScores
import redis.clients.jedis.Tuple; //导入依赖的package包/类
public static final Set<Tuple> zrevrangeWithScores(final String key, final int start, final int end) {
return JedisTemplate.run(key, new Executor<Set<Tuple>>() {
public Set<Tuple> execute(ShardedJedis jedis) {
return jedis.zrevrangeWithScores(key, start, end);
}
});
}