本文整理汇总了Java中org.springframework.data.redis.connection.RedisZSetCommands.Tuple类的典型用法代码示例。如果您正苦于以下问题:Java Tuple类的具体用法?Java Tuple怎么用?Java Tuple使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Tuple类属于org.springframework.data.redis.connection.RedisZSetCommands包,在下文中一共展示了Tuple类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rawTupleValues
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
@SuppressWarnings("unchecked")
Set<Tuple> rawTupleValues(Set<TypedTuple<V>> values) {
if (values == null) {
return null;
}
Set<Tuple> rawTuples = new LinkedHashSet<Tuple>(values.size());
for (TypedTuple<V> value : values) {
byte[] rawValue;
if (valueSerializer() == null && value.getValue() instanceof byte[]) {
rawValue = (byte[]) value.getValue();
} else {
rawValue = valueSerializer().serialize(value.getValue());
}
rawTuples.add(new DefaultTuple(rawValue, value.getScore()));
}
return rawTuples;
}
示例2: scan
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
@Override
public Cursor<TypedTuple<V>> scan(K key, final ScanOptions options) {
final byte[] rawKey = rawKey(key);
Cursor<Tuple> cursor = execute(new RedisCallback<Cursor<Tuple>>() {
@Override
public Cursor<Tuple> doInRedis(RedisConnection connection) throws DataAccessException {
connection.select(dbIndex);
return connection.zScan(rawKey, options);
}
}, true);
return new ConvertingCursor<Tuple, TypedTuple<V>>(cursor, new Converter<Tuple, TypedTuple<V>>() {
@Override
public TypedTuple<V> convert(Tuple source) {
return deserializeTuple(source);
}
});
}
示例3: zRevRangeByScoreWithScore
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
public <K, V> Set<TypedTuple<V>> zRevRangeByScoreWithScore(K key, double min,
double max, long limit, long skip, Class<V> classNm) {
NaviShardJedisDriver driver = getDriver();
try {
Set<Tuple> set = limit > 0 ? driver.zRevRangeByScoreWithScores(
object2Bytes(key), min, max, skip, limit) : driver
.zRevRangeByScoreWithScores(object2Bytes(key), min, max);
Set<TypedTuple<V>> result = new LinkedHashSet<TypedTuple<V>>();
for (Tuple t : set) {
result.add(new DefaultTypedTuple<V>(bytes2Object(t.getValue(),
classNm), t.getScore()));
}
return result;
} finally {
driver.close();
}
}
示例4: zRangeByScoreWithScore
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
public <K, V> Set<TypedTuple<V>> zRangeByScoreWithScore(K key, double min,
double max, long limit, long skip, Class<V> classNm) {
NaviShardJedisDriver driver = getDriver();
try {
Set<Tuple> set = limit > 0 ? driver.zRangeByScoreWithScores(
object2Bytes(key), min, max, skip, limit) : driver
.zRangeByScoreWithScores(object2Bytes(key), min, max);
Set<TypedTuple<V>> result = new LinkedHashSet<TypedTuple<V>>();
for (Tuple t : set) {
result.add(new DefaultTypedTuple<V>(bytes2Object(t.getValue(),
classNm), t.getScore()));
}
return result;
} finally {
driver.close();
}
}
示例5: zadd
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
@Override
public long zadd(final byte[] key, final Set<Tuple> tuples) {
redisTemplate.execute(new RedisCallback<Long>() {
@Override
public Long doInRedis(RedisConnection connection) throws DataAccessException {
return connection.zAdd(key, tuples);
}
});
return 0;
}
示例6: deserializeTupleValues
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
Set<TypedTuple<V>> deserializeTupleValues(Collection<Tuple> rawValues) {
if (rawValues == null) {
return null;
}
Set<TypedTuple<V>> set = new LinkedHashSet<TypedTuple<V>>(rawValues.size());
for (Tuple rawValue : rawValues) {
set.add(deserializeTuple(rawValue));
}
return set;
}
示例7: deserializeTuple
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
TypedTuple<V> deserializeTuple(Tuple tuple) {
Object value = tuple.getValue();
if (valueSerializer() != null) {
value = valueSerializer().deserialize(tuple.getValue());
}
return new DefaultTypedTuple(value, tuple.getScore());
}
示例8: add
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
public Long add(K key, Set<TypedTuple<V>> tuples) {
final byte[] rawKey = rawKey(key);
final Set<Tuple> rawValues = rawTupleValues(tuples);
return execute(new RedisCallback<Long>() {
public Long doInRedis(RedisConnection connection) {
connection.select(dbIndex);
return connection.zAdd(rawKey, rawValues);
}
}, true);
}
示例9: rangeWithScores
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
public Set<TypedTuple<V>> rangeWithScores(K key, final long start, final long end) {
final byte[] rawKey = rawKey(key);
Set<Tuple> rawValues = execute(new RedisCallback<Set<Tuple>>() {
public Set<Tuple> doInRedis(RedisConnection connection) {
connection.select(dbIndex);
return connection.zRangeWithScores(rawKey, start, end);
}
}, true);
return deserializeTupleValues(rawValues);
}
示例10: reverseRangeWithScores
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
public Set<TypedTuple<V>> reverseRangeWithScores(K key, final long start, final long end) {
final byte[] rawKey = rawKey(key);
Set<Tuple> rawValues = execute(new RedisCallback<Set<Tuple>>() {
public Set<Tuple> doInRedis(RedisConnection connection) {
connection.select(dbIndex);
return connection.zRevRangeWithScores(rawKey, start, end);
}
}, true);
return deserializeTupleValues(rawValues);
}
示例11: rangeByScoreWithScores
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
public Set<TypedTuple<V>> rangeByScoreWithScores(K key, final double min, final double max) {
final byte[] rawKey = rawKey(key);
Set<Tuple> rawValues = execute(new RedisCallback<Set<Tuple>>() {
public Set<Tuple> doInRedis(RedisConnection connection) {
connection.select(dbIndex);
return connection.zRangeByScoreWithScores(rawKey, min, max);
}
}, true);
return deserializeTupleValues(rawValues);
}
示例12: reverseRangeByScoreWithScores
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
public Set<TypedTuple<V>> reverseRangeByScoreWithScores(K key, final double min, final double max) {
final byte[] rawKey = rawKey(key);
Set<Tuple> rawValues = execute(new RedisCallback<Set<Tuple>>() {
public Set<Tuple> doInRedis(RedisConnection connection) {
connection.select(dbIndex);
return connection.zRevRangeByScoreWithScores(rawKey, min, max);
}
}, true);
return deserializeTupleValues(rawValues);
}
示例13: zRangeWithScore
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
public <K, V> Set<TypedTuple<V>> zRangeWithScore(K key, long start,
long end, Class<V> classNm) {
NaviShardJedisDriver driver = getDriver();
try {
Set<Tuple> set = driver.zRangeWithScores(object2Bytes(key), start, end);
Set<TypedTuple<V>> result = new LinkedHashSet<TypedTuple<V>>();
for (Tuple t : set) {
result.add(new DefaultTypedTuple<V>(bytes2Object(t.getValue(),
classNm), t.getScore()));
}
return result;
} finally {
driver.close();
}
}
示例14: zReverseRangeWithScore
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
public <K, V> Set<TypedTuple<V>> zReverseRangeWithScore(K key, long start,
long end, Class<V> classNm) {
NaviShardJedisDriver driver = getDriver();
try {
Set<Tuple> set = driver.zRevRangeWithScores(object2Bytes(key), start, end);
Set<TypedTuple<V>> result = new LinkedHashSet<TypedTuple<V>>();
for (Tuple t : set) {
result.add(new DefaultTypedTuple<V>(bytes2Object(t.getValue(),
classNm), t.getScore()));
}
return result;
} finally {
driver.close();
}
}
示例15: zRevRangeByScoreWithScore
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //导入依赖的package包/类
public <K, V> Set<TypedTuple<V>> zRevRangeByScoreWithScore(K key, double min, double max, long limit, long skip, Class<V> classNm) {
AbstractNaviPoolJedisDriver driver = getDriver();
Set<Tuple> set = limit > 0 ? driver.zRevRangeByScoreWithScores(
object2Bytes(key), min, max, skip, limit) : driver.zRevRangeByScoreWithScores(object2Bytes(key), min, max
);
Set<TypedTuple<V>> result = new LinkedHashSet<>();
for (Tuple t : set) {
result.add(new DefaultTypedTuple<V>(bytes2Object(t.getValue(), classNm), t.getScore()));
}
return result;
}