Package redis.clients.jedis

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


                p.sync();
                if (exec.get() == null) {
                    p = jedis.pipelined();
                    p.watch(keys.COUNTS_KEY, keys.BITS_KEY);
                    Response<List<String>> hmget = p.hmget(keys.COUNTS_KEY, hashesString);
                    p.sync();
                    counts = hmget.get().stream().map(Long::valueOf).collect(Collectors.toList());
                } else {
                    return Collections.min(counts);
                }
            }
View Full Code Here


            List<Long> counts;
            List<Response<Long>> responses = new ArrayList<>(config().hashes());
            for (String position : hashesString) {
                responses.add(p.hincrBy(keys.COUNTS_KEY, position, -1));
            }
            p.sync();
            counts = responses.stream().map(Response::get).collect(Collectors.toList());

            while (true) {
                p = jedis.pipelined();
                p.multi();
View Full Code Here

                for (int i = 0; i < config().hashes(); i++) {
                    if (counts.get(i) <= 0)
                        bloom.set(p, hashes[i], false);
                }
                Response<List<Object>> exec = p.exec();
                p.sync();
                if (exec.get() == null) {
                    p = jedis.pipelined();
                    p.watch(keys.COUNTS_KEY, keys.BITS_KEY);
                    Response<List<String>> hmget = p.hmget(keys.COUNTS_KEY, hashesString);
                    p.sync();
View Full Code Here

                p.sync();
                if (exec.get() == null) {
                    p = jedis.pipelined();
                    p.watch(keys.COUNTS_KEY, keys.BITS_KEY);
                    Response<List<String>> hmget = p.hmget(keys.COUNTS_KEY, hashesString);
                    p.sync();
                    counts = hmget.get().stream().map(Long::valueOf).collect(Collectors.toList());
                } else {
                    return Collections.min(counts);
                }
            }
View Full Code Here

      pipe.del(key);
      for (String entry : entries) {
        pipe.sadd(key, entry);
      }
      pipe.expire(key, (int) TimeUnit.DAYS.toSeconds(7));
      pipe.sync();
    }
  }

  @Override
  public Category getUserRootCategory(User user) {
View Full Code Here

      Pipeline pipe = jedis.pipelined();
      pipe.del(key);
      pipe.set(key, MAPPER.writeValueAsString(category));
      pipe.expire(key, (int) TimeUnit.MINUTES.toSeconds(30));
      pipe.sync();
    } catch (JsonProcessingException e) {
      log.error(e.getMessage(), e);
    }
  }
View Full Code Here

      Pipeline pipe = jedis.pipelined();
      pipe.del(key);
      pipe.set(key, MAPPER.writeValueAsString(count));
      pipe.expire(key, (int) TimeUnit.MINUTES.toSeconds(30));
      pipe.sync();
    } catch (Exception e) {
      log.error(e.getMessage(), e);
    }
  }
View Full Code Here

        for (User user : users) {
          String key = buildRedisUserRootCategoryKey(user);
          pipe.del(key);
        }
      }
      pipe.sync();
    }
  }

  @Override
  public void invalidateUnreadCount(FeedSubscription... subs) {
View Full Code Here

        for (FeedSubscription sub : subs) {
          String key = buildRedisUnreadCountKey(sub);
          pipe.del(key);
        }
      }
      pipe.sync();
    }
  }

  private String buildRedisEntryKey(Feed feed) {
    return "f:" + Models.getId(feed);
View Full Code Here

    boolean broken = false;
    try {
      jedis = jedisPool.getResource();
      Pipeline pipeline = jedis.pipelined();
      pipelineAction.action(pipeline);
      pipeline.sync();
    } catch (JedisException e) {
      broken = handleJedisException(e);
      throw e;
    } finally {
      closeResource(jedis, broken);
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.