Package redis.clients.jedis

Examples of redis.clients.jedis.Jedis.sadd()


    public Set<String> sCopy(String key, String new_key) {
        Jedis jedis = borrow();
        try {
            Set<String> oldSets = jedis.smembers(key);
            for (String str : oldSets) {
                jedis.sadd(new_key, str);
            }
            return oldSets;
        } finally {
            revert(jedis);
        }
View Full Code Here


    }

    // Redis Set Operations
    public Long sadd(String member) {
        Jedis jedis = getResource();
        Long reply = jedis.sadd(key(), member);
        returnResource(jedis);
        return reply;
    }

    public Long srem(String member) {
View Full Code Here

    }

    public void appendIpAddress(String ipAddress) {
        Jedis jedis = jedisPool.getResource();
        try {
            jedis.sadd("ipAddresses", ipAddress);
        } catch (JedisConnectionException je) {
            if (null != jedis) {
                jedisPool.returnBrokenResource(jedis);
                jedis = null;
            }
View Full Code Here

    public boolean isDuplicate(Request request, Task task) {
        Jedis jedis = pool.getResource();
        try {
            boolean isDuplicate = jedis.sismember(getSetKey(task), request.getUrl());
            if (!isDuplicate) {
                jedis.sadd(getSetKey(task), request.getUrl());
            }
            return isDuplicate;
        } finally {
            pool.returnResource(jedis);
        }
View Full Code Here

        final Jedis jedis = TestUtils.createJedis(config);

        // Submit a job containing incorrect JSON.
        String incorrectJson = "{";
        jedis.sadd(JesqueUtils.createKey(config.getNamespace(), QUEUES), queue);
        jedis.rpush(JesqueUtils.createKey(config.getNamespace(), QUEUE, queue), incorrectJson);

        final Worker worker = new WorkerImpl(config, Arrays.asList(queue),
                new MapBasedJobFactory(JesqueUtils.map(JesqueUtils.entry("SleepAction", SleepAction.class))));
        final Thread workerThread = new Thread(worker);
View Full Code Here

        final Jedis jedis = jedisPool.getResource();
        try {
            jedis.set(ackLookupKey(channelId), Long.toString(version));
            final List<String> hashValues = jedis.hmget(chidLookupKey(channelId), UAID_KEY);
            final String uaid = hashValues.get(0);
            jedis.sadd(acksLookupKey(uaid), channelId);
            return uaid;
        } finally {
            jedisPool.returnResource(jedis);
        }
    }
View Full Code Here

    }
  }
 
  protected void updateIdentifiers(ExternalId security) {
    Jedis jedis = _jedisPool.getResource();
    jedis.sadd(generateAllSchemesKey(), security.getScheme().getName());
    jedis.sadd(generatePerSchemeKey(security.getScheme().getName()), security.getValue());
    _jedisPool.returnResource(jedis);
  }

  @Override
View Full Code Here

  }
 
  protected void updateIdentifiers(ExternalId security) {
    Jedis jedis = _jedisPool.getResource();
    jedis.sadd(generateAllSchemesKey(), security.getScheme().getName());
    jedis.sadd(generatePerSchemeKey(security.getScheme().getName()), security.getValue());
    _jedisPool.returnResource(jedis);
  }

  @Override
  public Set<String> getAllIdentifiers(String identifierScheme) {
View Full Code Here

      try {
       
        for (ExternalId externalId : security.getExternalIdBundle()) {
          String redisKey = toRedisKey(externalId);
         
          jedis.sadd(redisKey, uniqueId.toString());
          if (jedis.scard(redisKey) > 1) {
            s_logger.warn("Multiple securities with same ExternalId {}. Probable misuse.", externalId);
          }
        }
       
View Full Code Here

    String classNameRedisKey = getClassNameRedisKey(clazz, configName);
    byte[] uniqueIdKey = getUniqueIdKey(uniqueId);
   
    Jedis jedis = getJedisPool().getResource();
    try {
      jedis.sadd(_allClassesKey, clazz.getName());
      jedis.sadd(classKeyName, configName);
      jedis.hset(classNameRedisKey, "UniqueId", uniqueId.toString());
      jedis.hset(uniqueIdKey, DATA_NAME_AS_BYTES, objectAsBytes);
      jedis.hset(uniqueIdKey, CLASS_NAME_AS_BYTES, clazz.getName().getBytes(Charsets.UTF_8));
      jedis.hset(uniqueIdKey, ITEM_NAME_AS_BYTES, configName.getBytes(Charsets.UTF_8));
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.