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


Java Pipeline.zadd方法代码示例

本文整理汇总了Java中redis.clients.jedis.Pipeline.zadd方法的典型用法代码示例。如果您正苦于以下问题:Java Pipeline.zadd方法的具体用法?Java Pipeline.zadd怎么用?Java Pipeline.zadd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在redis.clients.jedis.Pipeline的用法示例。


在下文中一共展示了Pipeline.zadd方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scheduleMulti

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
/**
 * Add multiple jobs to the TimeBasedJobScheduler, using a pipeline command to avoid O(n) network round trips.
 * Note that this implementation does not support quiescence.
 * @see #schedule(String, String, long, long)
 *
 * @param tube Used in conjunction with the redisPrefixKey (constructor) to make up the full redis key name.
 * @param jobStrs String representations of the jobs to be scheduled
 * @param millisInFuture The "priority" of the job in terms of the number of millis in the future that this job should become available.
 * @return number of newly scheduled jobs
 */
public int scheduleMulti(final String tube, final Iterable<String> jobStrs, final long millisInFuture) {
    try (Handle handle = rdbi.open()) {
        final Pipeline pl = handle.jedis().pipelined();
        for (String jobStr : jobStrs) {
            pl.zadd(getReadyQueue(tube),
                    Instant.now().getMillis() + millisInFuture,
                    jobStr);
        }
        int numAdded = 0;
        for (Object rslt : pl.syncAndReturnAll()) {
            numAdded += (Long) rslt;
        }
        return numAdded;
    }
}
 
开发者ID:lithiumtech,项目名称:rdbi,代码行数:26,代码来源:TimeBasedJobScheduler.java

示例2: indexNumeric

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
void indexNumeric(String fieldName, String docId, Number value, Pipeline pipe) {
    Jedis conn = null;
    if (pipe == null) {
        conn = pool.getResource();
        pipe = conn.pipelined();
    }

    pipe.zadd(fieldKey(fieldName), value.doubleValue(), docId);

    // only if the connection was not provided to us - commit everything
    if (conn != null) {
        pipe.sync();
        conn.close();
    }
}
 
开发者ID:RedisLabs,项目名称:ReSearch,代码行数:16,代码来源:FullTextFacetedIndex.java

示例3: indexFulltextFields

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
void indexFulltextFields(Spec.FulltextField spec, Document doc, Pipeline pipe) {

        Jedis conn = null;
        if (pipe == null) {
            conn = pool.getResource();
            pipe = conn.pipelined();
        }

        TokenSet mergedTokens = new TokenSet();

        for (Map.Entry<String, Double> entry : spec.fields.entrySet()) {

            if (doc.hasProperty(entry.getKey())) {

                Object p = doc.property(entry.getKey());
                if (p != null && p instanceof String) {
                    List<Token> tokens = tokenizer.tokenize((String)p);
                    mergedTokens.addAll(tokens, entry.getValue());
                }
            }

        }
        mergedTokens.normalize(mergedTokens.getMaxFreq());

        for (Token tok : mergedTokens.values()) {
            pipe.zadd(tokenKey(tok.text), doc.getScore() * (0.5 + 0.5*tok.frequency), doc.getId());
        }

        // only if the connection was not provided to us - commit everything
        if (conn != null) {
            pipe.sync();
            conn.close();
        }
    }
 
开发者ID:RedisLabs,项目名称:ReSearch,代码行数:35,代码来源:FullTextFacetedIndex.java

示例4: internalPipelinedAdd

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
private void internalPipelinedAdd(final ValueType value, final Pipeline pl, final double score) {
    final String valueAsString = serializationHelper.encode(value);
    pl.zadd(redisSetKey, score, valueAsString);
}
 
开发者ID:lithiumtech,项目名称:rdbi,代码行数:5,代码来源:RedisSet.java

示例5: indexGeoPoint

import redis.clients.jedis.Pipeline; //导入方法依赖的package包/类
void indexGeoPoint(String docId, Double lat, Double lon, int precision, Pipeline pipe) {
    GeoHash coarse = GeoHash.withCharacterPrecision(lat, lon, precision);
    GeoHash fine = GeoHash.withBitPrecision(lat, lon, 53);

    pipe.zadd(geoKey(coarse.toBase32()), fine.longValue(), docId);

}
 
开发者ID:RedisLabs,项目名称:ReSearch,代码行数:8,代码来源:FullTextFacetedIndex.java


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