本文整理匯總了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);
}
});
}