Package redis.clients.jedis

Examples of redis.clients.jedis.ShardedJedis.zrangeByScore()


             long ts2 = System.currentTimeMillis();
             CQSControllerServlet.valueAccumulator.addToCounter(AccumulatorName.RedisTime, (ts2 - ts1));
           }
           else {
             long ts1 = System.currentTimeMillis();
             memIds = jedis.zrangeByScore(key, System.currentTimeMillis() - queue.getMsgRetentionPeriod() * 1000, System.currentTimeMillis(), 0, maxNumberOfMessages);
             long ts2 = System.currentTimeMillis();
             CQSControllerServlet.valueAccumulator.addToCounter(AccumulatorName.RedisTime, (ts2 - ts1));
             if (memIds == null || memIds.equals("nil")) { //done
               emptyQueue = true;
             }
View Full Code Here


            boolean brokenJedis = false;
            ShardedJedis jedis = getResource();
            try {
                //jedis is lame and does not have a constant for "-inf" which Redis supports. So we have to
                //pick an arbitrary old min value.
                Set<String> revisibleSet = jedis.zrangeByScore(queueUrl + "-" + shard + "-V", System.currentTimeMillis() - (1000 * 3600 * 24 * 14), System.currentTimeMillis());
                for (String revisibleMemId : revisibleSet) {
                    jedis.rpush(queueUrl + "-" + shard + "-Q", revisibleMemId);
                    jedis.zrem(queueUrl + "-" + shard + "-V", revisibleMemId);
                }
                ts2 = System.currentTimeMillis();
View Full Code Here

         return Collections.emptyList();
       }

       //if no previousReceiptHandle and no nextReceiptHandle, just retrieve from beginning
       if (previousReceiptHandle == null && nextReceiptHandle == null) {
         memIds = jedis.zrangeByScore(key, System.currentTimeMillis() - retention * 1000L, System.currentTimeMillis(), 0, num);
         if (memIds != null){
           memIdsRet = new ArrayList<String>(memIds);
         }
       }
       //else find the score for previous receipt,
View Full Code Here

       //   if not exist, same as no previous receipt
       //   else use zrangeByScore with limit
       else if (previousReceiptHandle != null) {
         Double previousScore = jedis.zscore(key, previousReceiptHandle);
         if (previousScore == null) {
           memIds = jedis.zrangeByScore(key, System.currentTimeMillis() - retention * 1000L, System.currentTimeMillis(), 0, num);
           if (memIds != null){
             memIdsRet = new ArrayList<String>(memIds);
           }
         } else {

View Full Code Here

           int i = 0;
           boolean includeSet = (previousReceiptHandle == null) ? true : false;

           while (retCount < num && i < llen) {

             memIds = jedis.zrangeByScore(key, startTime, System.currentTimeMillis(), i, num);

             if (memIds.size() == 0) {
               break; // done
             }
View Full Code Here

       } else { //this means previousReceiptHandle == null and nextReceiptHandle != null. Retrieve id backward
         //return result will exclude the nextReceiptHandle
         //retrieve nextReceiptHandle, get index. if not exist, retrieve from beginning.
         Long endRank = jedis.zrank(key, nextReceiptHandle);
         if (endRank == null) {
           memIds = jedis.zrangeByScore(key, System.currentTimeMillis() - retention * 1000L, System.currentTimeMillis(), 0, num);
           if (memIds != null){
             memIdsRet = new ArrayList<String>(memIds);
           }
         }
         //if index exist, retrieve based on index. When get result, remove expired id
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.