當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。