Examples of Jedis


Examples of redis.clients.jedis.Jedis

            revert(jedis);
        }
    }

    public List<String> bMget(String[] keys) {
        Jedis jedis = borrow();
        int len = keys.length;
        byte[][] bkeys = new byte[len][];
        for (int i = 0; i < keys.length; i++) {
            bkeys[i] = keys[i].getBytes();
        }
        try {
            List<byte[]> list = jedis.mget(bkeys);
            List<String> temp_list = new ArrayList<String>(list.size());
            for (byte[] temp : list) {
                temp_list.add(GZip.decodeWithGZip(temp));
            }
            return temp_list;
View Full Code Here

Examples of redis.clients.jedis.Jedis

            revert(jedis);
        }
    }

    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

Examples of redis.clients.jedis.Jedis

            revert(jedis);
        }
    }

    public void sClear(String key, String oldKey) {
        Jedis jedis = borrow();
        try {
            Set<String> oldSets = jedis.smembers(key);
            for (String str : oldSets) {
                jedis.del(oldKey + ":" + str);
            }
            jedis.del(key);
        } finally {
            revert(jedis);
        }
    }
View Full Code Here

Examples of redis.clients.jedis.Jedis

            revert(jedis);
        }
    }

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

Examples of redis.clients.jedis.Jedis

    public interface Callback {
        public void execute(Jedis jedis);
    }

    public void operate(Callback callback) {
        Jedis jedis = borrow();
        try {
            callback.execute(jedis);
        } finally {
            revert(jedis);
        }
View Full Code Here

Examples of redis.clients.jedis.Jedis

                disconnectSubscriber();
            }
        }

        // We use the pool only for publishing
        jedisSubscriber = new Jedis(uri.getHost(), uri.getPort());
        try {
            jedisSubscriber.connect();
            auth(jedisSubscriber);
        } catch (JedisException e) {
            logger.error("failed to connect subscriber", e);
            disconnectSubscriber();
        }

        jedisPublisher = sharedPool ? null : new Jedis(uri.getHost(), uri.getPort());
        if (!sharedPool) {
            try {
                jedisPublisher.connect();
                auth(jedisPublisher);
            } catch (JedisException e) {
View Full Code Here

Examples of redis.clients.jedis.Jedis

            }

            if (sharedPool) {
                for (int i = 0; i < 10; ++i) {
                    boolean valid = true;
                    Jedis jedis = jedisPool.getResource();

                    try {
                        auth(jedis);
                        jedis.publish(callback.getID(), contents);
                    } catch (JedisException e) {
                        valid = false;
                        logger.warn("outgoingBroadcast exception", e);
                    } finally {
                        if (valid) {
View Full Code Here

Examples of redis.clients.jedis.Jedis

    private ShardedJedis jedis;

    @Before
    public void setUp() throws Exception {
  Jedis jedis = new Jedis(redis1.getHost(), redis1.getPort());
  jedis.auth("foobared");
  jedis.flushAll();
  jedis.disconnect();
  jedis = new Jedis(redis2.getHost(), redis2.getPort());
  jedis.auth("foobared");
  jedis.flushAll();
  jedis.disconnect();

  JedisShardInfo shardInfo1 = new JedisShardInfo(redis1.getHost(),
    redis1.getPort());
  JedisShardInfo shardInfo2 = new JedisShardInfo(redis2.getHost(),
    redis2.getPort());
View Full Code Here

Examples of redis.clients.jedis.Jedis

  shards = new ArrayList<JedisShardInfo>();
  shards.add(new JedisShardInfo(redis1.getHost(), redis1.getPort()));
  shards.add(new JedisShardInfo(redis2.getHost(), redis2.getPort()));
  shards.get(0).setPassword("foobared");
  shards.get(1).setPassword("foobared");
  Jedis j = new Jedis(shards.get(0));
  j.connect();
  j.flushAll();
  j.disconnect();
  j = new Jedis(shards.get(1));
  j.connect();
  j.flushAll();
  j.disconnect();

    }
View Full Code Here

Examples of redis.clients.jedis.Jedis

    private Jedis jedis;

    @Before
    public void setUp() throws Exception {
  jedis = new Jedis(hnp.getHost(), hnp.getPort(), 500);
  jedis.connect();
  jedis.auth("foobared");
  jedis.flushAll();
    }
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.