当前位置: 首页>>代码示例>>Java>>正文


Java ScoredValue类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:18,代码来源:ScanIteratorTest.java

示例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();
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:20,代码来源:ScanIteratorTest.java

示例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);
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:17,代码来源:ScanIteratorTest.java

示例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;
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:13,代码来源:ScoredValueListOutput.java

示例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;
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:14,代码来源:ScoredValueStreamingOutput.java

示例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);
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:13,代码来源:ScoredValueScanStreamingOutput.java

示例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;
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:13,代码来源:ScoredValueScanOutput.java

示例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"));
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:11,代码来源:ScoredValueListOutputTest.java

示例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;
}
 
开发者ID:hakusaro,项目名称:ShankShock-Core,代码行数:12,代码来源:ScoredValueListOutput.java

示例10: sv

import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
protected ScoredValue<String> sv(double score, String value) {
    return new ScoredValue<String>(score, value);
}
 
开发者ID:mp911de,项目名称:spinach,代码行数:4,代码来源:AbstractCommandTest.java

示例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;
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:6,代码来源:ScoredValueListOutput.java

示例12: getSubscriber

import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
@Override
public Subscriber<ScoredValue<V>> getSubscriber() {
    return subscriber;
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:5,代码来源:ScoredValueListOutput.java

示例13: ScoredValueListOutput

import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
public ScoredValueListOutput(RedisCodec<K, V> codec) {
    super(codec, new ArrayList<ScoredValue<V>>());
}
 
开发者ID:hakusaro,项目名称:ShankShock-Core,代码行数:4,代码来源:ScoredValueListOutput.java

示例14: onValue

import com.lambdaworks.redis.ScoredValue; //导入依赖的package包/类
/**
 * Called on every incoming ScoredValue.
 *
 * @param value the scored value
 */
void onValue(ScoredValue<V> value);
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:7,代码来源:ScoredValueStreamingChannel.java


注:本文中的com.lambdaworks.redis.ScoredValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。