本文整理汇总了Java中com.lambdaworks.redis.ScoredValue类的典型用法代码示例。如果您正苦于以下问题:Java ScoredValue类的具体用法?Java ScoredValue怎么用?Java ScoredValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ScoredValue类属于com.lambdaworks.redis包,在下文中一共展示了ScoredValue类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: zscanShouldThrowNoSuchElementExceptionOnEmpty
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
@Test
public void zscanShouldThrowNoSuchElementExceptionOnEmpty() throws Exception {
for (int i = 0; i < KeysAndValues.COUNT; i++) {
redis.zadd(key, new ScoredValue<>(i, KeysAndValues.KEYS.get(i)));
}
ScanIterator<ScoredValue<String>> scan = ScanIterator.zscan(redis, "none", ScanArgs.Builder.limit(50).match("key-foo"));
assertThat(scan.hasNext()).isFalse();
try {
scan.next();
fail("Missing NoSuchElementException");
} catch (NoSuchElementException e) {
assertThat(e).isInstanceOf(NoSuchElementException.class);
}
}
示例2: zsetSinglePass
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
@Test
public void zsetSinglePass() throws Exception {
for (int i = 0; i < KeysAndValues.COUNT; i++) {
redis.zadd(key, new ScoredValue<>(i, KeysAndValues.KEYS.get(i)));
}
ScanIterator<ScoredValue<String>> scan = ScanIterator.zscan(redis, key, ScanArgs.Builder.limit(50).match("key-11*"));
assertThat(scan.hasNext()).isTrue();
assertThat(scan.hasNext()).isTrue();
for (int i = 0; i < 11; i++) {
assertThat(scan.hasNext()).isTrue();
assertThat(scan.next()).isNotNull();
}
assertThat(scan.hasNext()).isFalse();
}
示例3: zsetMultiPass
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
@Test
public void zsetMultiPass() throws Exception {
List<ScoredValue<String>> expected = new ArrayList<>();
for (int i = 0; i < KeysAndValues.COUNT; i++) {
ScoredValue<String> scoredValue = new ScoredValue<>(i, KeysAndValues.KEYS.get(i));
expected.add(scoredValue);
redis.zadd(key, scoredValue);
}
ScanIterator<ScoredValue<String>> scan = ScanIterator.zscan(redis, key);
List<ScoredValue<String>> values = scan.stream().collect(Collectors.toList());
assertThat(values).containsAll(values);
}
示例4: set
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
@Override
public void set(ByteBuffer bytes) {
if (value == null) {
value = codec.decodeValue(bytes);
return;
}
double score = LettuceStrings.toDouble(decodeAscii(bytes));
subscriber.onNext(output, new ScoredValue<>(score, value));
value = null;
}
示例5: set
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
@Override
public void set(ByteBuffer bytes) {
if (value == null) {
value = codec.decodeValue(bytes);
return;
}
double score = LettuceStrings.toDouble(decodeAscii(bytes));
channel.onValue(new ScoredValue<>(score, value));
value = null;
output = output.longValue() + 1;
}
示例6: setOutput
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
@Override
protected void setOutput(ByteBuffer bytes) {
if (value == null) {
value = codec.decodeValue(bytes);
return;
}
double score = LettuceStrings.toDouble(decodeAscii(bytes));
channel.onValue(new ScoredValue<>(score, value));
value = null;
output.setCount(output.getCount() + 1);
}
示例7: setOutput
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
@Override
protected void setOutput(ByteBuffer bytes) {
if (value == null) {
value = codec.decodeValue(bytes);
return;
}
double score = LettuceStrings.toDouble(decodeAscii(bytes));
output.getValues().add(new ScoredValue<>(score, value));
value = null;
}
示例8: commandOutputCorrectlyDecoded
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
@Test
public void commandOutputCorrectlyDecoded() {
sut.multi(1);
sut.set(ByteBuffer.wrap("key".getBytes()));
sut.set(ByteBuffer.wrap("4.567".getBytes()));
sut.multi(-1);
assertThat(sut.get()).contains(new ScoredValue<>(4.567, "key"));
}
示例9: set
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
@Override
public void set(ByteBuffer bytes) {
if (value == null) {
value = codec.decodeValue(bytes);
return;
}
double score = Double.parseDouble(decodeAscii(bytes));
output.add(new ScoredValue<V>(score, value));
value = null;
}
示例10: sv
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
protected ScoredValue<String> sv(double score, String value) {
return new ScoredValue<String>(score, value);
}
示例11: setSubscriber
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
@Override
public void setSubscriber(Subscriber<ScoredValue<V>> subscriber) {
LettuceAssert.notNull(subscriber, "Subscriber must not be null");
this.subscriber = subscriber;
}
示例12: getSubscriber
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
@Override
public Subscriber<ScoredValue<V>> getSubscriber() {
return subscriber;
}
示例13: ScoredValueListOutput
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
public ScoredValueListOutput(RedisCodec<K, V> codec) {
super(codec, new ArrayList<ScoredValue<V>>());
}
示例14: onValue
import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
/**
* Called on every incoming ScoredValue.
*
* @param value the scored value
*/
void onValue(ScoredValue<V> value);