Examples of zadd()


Examples of redis.clients.jedis.Pipeline.zadd()

                p.hincrBy(idx.cat(Seek.INFO).key(), field.getKey(), 1);
            }
            for (String tag : tags) {
                idx.cat(tag);
                String key = idx.key();
                p.zadd(key, order, id);
                p.rpush(idx.cat(id).key(), key);
                p.rpush(idx.cat(id).cat(Seek.TAGS).key(), tag);

                // adds on facets
                p.hincrBy(idx.cat(Seek.INFO).cat(Seek.TAGS).key(), tag, 1);
View Full Code Here

Examples of redis.clients.jedis.Pipeline.zadd()

            }
            for (Map.Entry<String, Set<String>> field : textFields.entrySet()) {
                for (String word : field.getValue()) {
                    idx.cat(field.getKey()).cat(word);
                    String key = idx.key();
                    p.zadd(key, order, id);
                    p.rpush(idx.cat(id).key(), key);
                }
            }
            p.incr(idx.cat(Seek.INFO).cat(Seek.TOTAL).key());
            p.execute();
View Full Code Here

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

         String clientId = message.getSuppliedMessageId();
         String messageId = message.getMessageId();
         String memId = getMemQueueMessage(messageId);
         if (cacheAvailable) {     
           try {
             jedis.zadd(queue.getRelativeUrl() + "-" + shard + "-Q", System.currentTimeMillis() + (delaySeconds * 1000), memId); //insert or update already existing
             //expire old message
             jedis.zremrangeByScore(queue.getRelativeUrl() + "-" + shard + "-Q","-inf",String.valueOf(System.currentTimeMillis() -
                 (queue.getMsgRetentionPeriod() * 1000)));
           } catch (JedisConnectionException e) {
             trySettingCacheState(queue.getRelativeUrl(), shard, QCacheState.Unavailable);
View Full Code Here

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

           } catch (PersistenceException e1) { //If cassandra exception, push messages back
             logger.error("event=persistence_exception num_messages=" + messageIds.size() + " action=pushing_messages_back_to_redis");
             if (visibilityTO > 0) {
               for (String messageId : messageIds) {
                 String memId = messageIdToMemId.get(messageId);
                 jedis.zadd(queue.getRelativeUrl() + "-" + shard + "-Q", System.currentTimeMillis() , memId);
               }
             }
             throw e1;
           }
         }
View Full Code Here

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

       try {

         jedis = getResource();
         long ts1 = System.currentTimeMillis();
         jedis.zadd(queue.getRelativeUrl() + "-" + shard + "-Q", System.currentTimeMillis() + (visibilityTO * 1000), receiptHandle); //insert or update already existing                                 
         long ts2 = System.currentTimeMillis();
         CQSControllerServlet.valueAccumulator.addToCounter(AccumulatorName.RedisTime, (ts2 - ts1));
         return true;

       } catch (JedisConnectionException e) {
View Full Code Here

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

                delaySeconds = Integer.parseInt(message.getAttributes().get(CQSConstants.DELAY_SECONDS));
              }
              memId = getMemQueueMessage(messageId);
              jedis = getResource();
              if (delaySeconds > 0) {
                    jedis.zadd(queue.getRelativeUrl() + "-" + shard + "-V", System.currentTimeMillis() + (delaySeconds * 1000), memId); //insert or update already existing                 
              } else {
                  jedis.rpush(queue.getRelativeUrl() + "-" + shard + "-Q", memId);
              }
                logger.debug("event=send_message cache_available=true msg_id= " + memId + " queue_url=" + queue.getAbsoluteUrl() + " shard=" + shard);
            } else {
View Full Code Here

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

                String messageId = message.getMessageId();
                String memId = getMemQueueMessage(messageId);
                if (cacheAvailable) {     
                    try {
                      if (delaySeconds > 0) {
                            jedis.zadd(queue.getRelativeUrl() + "-" + shard + "-V", System.currentTimeMillis() + (delaySeconds * 1000), memId); //insert or update already existing                 
                      } else {
                        jedis.rpush(queue.getRelativeUrl() + "-" + shard + "-Q", memId);
                      }
                    } catch (JedisConnectionException e) {
                        trySettingCacheState(queue.getRelativeUrl(), shard, QCacheState.Unavailable);
View Full Code Here

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

         if (message.getAttributes().containsKey(CQSConstants.DELAY_SECONDS)) {
           delaySeconds = Integer.parseInt(message.getAttributes().get(CQSConstants.DELAY_SECONDS));
         }
         memId = getMemQueueMessage(messageId);
         jedis = getResource();
         jedis.zadd(queue.getRelativeUrl() + "-" + shard + "-Q", System.currentTimeMillis() + (delaySeconds * 1000), memId); //insert or update already existing                 
         //expire old message
         jedis.zremrangeByScore(queue.getRelativeUrl() + "-" + shard + "-Q","-inf",String.valueOf(System.currentTimeMillis() -
             (queue.getMsgRetentionPeriod() * 1000)));
         logger.debug("event=send_message cache_available=true msg_id= " + memId + " queue_url=" + queue.getAbsoluteUrl() + " shard=" + shard);
       } else {
View Full Code Here

Examples of redis.clients.jedis.Transaction.zadd()

        }

        long now = System.currentTimeMillis();

        Transaction trans = conn.multi();
        trans.zadd(fkey1, now, String.valueOf(otherUid));
        trans.zadd(fkey2, now, String.valueOf(uid));
        trans.zcard(fkey1);
        trans.zcard(fkey2);
        trans.zrevrangeWithScores("profile:" + otherUid, 0, HOME_TIMELINE_SIZE - 1);
View Full Code Here

Examples of redis.clients.jedis.Transaction.zadd()

        long now = System.currentTimeMillis();

        Transaction trans = conn.multi();
        trans.zadd(fkey1, now, String.valueOf(otherUid));
        trans.zadd(fkey2, now, String.valueOf(uid));
        trans.zcard(fkey1);
        trans.zcard(fkey2);
        trans.zrevrangeWithScores("profile:" + otherUid, 0, HOME_TIMELINE_SIZE - 1);

        List<Object> response = trans.exec();
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.