Package redis.clients.jedis

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


  public void setLastEntries(Feed feed, List<String> entries) {
    try (Jedis jedis = pool.getResource()) {
      String key = buildRedisEntryKey(feed);

      Pipeline pipe = jedis.pipelined();
      pipe.del(key);
      for (String entry : entries) {
        pipe.sadd(key, entry);
      }
      pipe.expire(key, (int) TimeUnit.DAYS.toSeconds(7));
      pipe.sync();
View Full Code Here


  public void setUserRootCategory(User user, Category category) {
    try (Jedis jedis = pool.getResource()) {
      String key = buildRedisUserRootCategoryKey(user);

      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

  public void setUnreadCount(FeedSubscription sub, UnreadCount count) {
    try (Jedis jedis = pool.getResource()) {
      String key = buildRedisUnreadCountKey(sub);

      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

    try (Jedis jedis = pool.getResource()) {
      Pipeline pipe = jedis.pipelined();
      if (users != null) {
        for (User user : users) {
          String key = buildRedisUserRootCategoryKey(user);
          pipe.del(key);
        }
      }
      pipe.sync();
    }
  }
View Full Code Here

    try (Jedis jedis = pool.getResource()) {
      Pipeline pipe = jedis.pipelined();
      if (subs != null) {
        for (FeedSubscription sub : subs) {
          String key = buildRedisUnreadCountKey(sub);
          pipe.del(key);
        }
      }
      pipe.sync();
    }
  }
View Full Code Here

        pipe.zunionstore(
            "location:max",
            new ZParams().aggregate(ZParams.Aggregate.MAX),
            tkey,
            "location:max");
        pipe.del(tkey);
        pipe.sync();
    }

    public Pair<Map<String,Long>,Map<String,Map<String,Long>>> aggregateLocation(Jedis conn) {
        Map<String,Long> countries = new HashMap<String,Long>();
View Full Code Here

            shard.del(idx.cat(Seek.INFO).cat(Seek.TOTAL).key());
            final Map<String, String> facets = shard.hgetAll(idx.cat(Seek.INFO)
                    .key());
            Pipeline p = shard.pipelined();
            for (String facetField : facets.keySet()) {
                p.del(idx.cat(Seek.INFO).cat(facetField).key());
            }
            p.del(idx.cat(Seek.INFO).key());
            p.execute();
            getPool().returnResource(jedis);
        } catch (Exception e) {
View Full Code Here

                    .key());
            Pipeline p = shard.pipelined();
            for (String facetField : facets.keySet()) {
                p.del(idx.cat(Seek.INFO).cat(facetField).key());
            }
            p.del(idx.cat(Seek.INFO).key());
            p.execute();
            getPool().returnResource(jedis);
        } catch (Exception e) {
            pool.returnResource(jedis);
            throw new SeekException(e);
View Full Code Here

            p = shard.pipelined();
            p.decr(ndx.cat(Seek.INFO).cat(Seek.TOTAL).key());
            for (byte[] index : indexes) {
                p.zrem(SafeEncoder.encode(index), id);
            }
            p.del(idx.key());
            for (byte[] tag : tags) {
                p.hincrBy(ndx.cat(Seek.INFO).cat(Seek.TAGS).key(), SafeEncoder
                        .encode(tag), -1);
            }
            Iterator<byte[]> iterator = fields.iterator();
View Full Code Here

                String field = SafeEncoder.encode(iterator.next());
                String key = SafeEncoder.encode(iterator.next());
                p.hincrBy(ndx.cat(Seek.INFO).key(), field, -1);
                p.hincrBy(ndx.cat(Seek.INFO).cat(field).key(), key, -1);
            }
            p.del(idx.cat(Seek.FIELDS).key());
            p.del(idx.cat(Seek.TAGS).key());
            p.execute();
            Seek.getPool().returnResource(jedis);
        } catch (Exception e) {
            Seek.getPool().returnResource(jedis);
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.