Package redis.clients.jedis

Examples of redis.clients.jedis.JedisShardInfo


    @Before
    public void setUp() throws Exception {
        redisServer = new RedisServer(6379);
        redisServer.start();

        JedisShardInfo shardInfo = new JedisShardInfo("localhost", 6379);
        connectionFactory = new JedisConnectionFactory();
        connectionFactory.setShardInfo(shardInfo);

        template = new StringRedisTemplate();
        template.setConnectionFactory(connectionFactory);
View Full Code Here


        Map<String, String> map = ResourceKit.readProperties(config);
        Set<Entry<String, String>> entrySet = map.entrySet();
        for (Entry<String, String> entry : entrySet) {
            parseSetting(entry.getKey(), entry.getValue().trim());
        }
        JedisShardInfo shardInfo = new JedisShardInfo(host, port, timeout);
        if (StrKit.notBlank(password)) {
            shardInfo.setPassword(password);
        }
        JedisPoolConfig poolConfig = new JedisPoolConfig();
        setPoolConfig(poolConfig);
        pool = new JedisPool(poolConfig, shardInfo.getHost(), shardInfo.getPort(), shardInfo.getTimeout(),
                shardInfo.getPassword());
        JedisKit.init(pool);
        return true;
    }
View Full Code Here

   * (non-Javadoc)
   * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
   */
  public void afterPropertiesSet() {
    if (shardInfo == null) {
      shardInfo = new JedisShardInfo(hostName, port);

      if (StringUtils.hasLength(password)) {
        shardInfo.setPassword(password);
      }

View Full Code Here

      try{
        String[] info = conStr.split(":");
        String host = info[0];
        int port = Integer.parseInt(info[1]);
        log.info(String.format(" + Adding shard %s:%d", host, port));
        JedisShardInfo si = new JedisShardInfo(host, port);
        shards.add(si);
      }catch(Exception e){
        log.error(String.format("Invalid shard info %s (connection string should be [host]:[port])", conStr ));
      }
    }
View Full Code Here

        String []arr = serverList.split(",");
       
        for (int i = 0; i < arr.length; i++) {
           
          String []hostPort = arr[i].trim().split(":");
          JedisShardInfo shardInfo = null;
          if (hostPort.length != 2) {
            // use Redis default port if one wasn't specified
             shardInfo = new JedisShardInfo(hostPort[0].trim(), 6379, 4000);
            } else {
               shardInfo = new JedisShardInfo(hostPort[0].trim(), Integer.parseInt(hostPort[1].trim()), 4000);
            }
            shardInfos.add(shardInfo);
        }
       
        pool = new ShardedJedisPool(cfg, shardInfos);
View Full Code Here

     String []arr = serverList.split(",");

     for (int i = 0; i < arr.length; i++) {

       String []hostPort = arr[i].trim().split(":");
       JedisShardInfo shardInfo = null;

       if (hostPort.length != 2) {
         // use Redis default port if one wasn't specified
         shardInfo = new JedisShardInfo(hostPort[0].trim(), 6379, 4000);
       } else {
         shardInfo = new JedisShardInfo(hostPort[0].trim(), Integer.parseInt(hostPort[1].trim()), 4000);
       }

       shardInfos.add(shardInfo);
     }
View Full Code Here

        jedis = new Jedis("localhost");
        jedis.flushAll();
        jedis.quit();
        jedis.disconnect();
        List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
        shards.add(new JedisShardInfo("localhost"));
        Config config = new Config();
        config.maxActive = 100;
        config.maxIdle = 100;
        config.minIdle = 100;
        config.testOnBorrow = true;
View Full Code Here

        jedis.flushAll();
        jedis.quit();
        jedis.disconnect();

        List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
        shards.add(new JedisShardInfo("localhost"));
        Config config = new Config();
        Seek.configure(config, shards);

        Seek seek = new Seek();
View Full Code Here

        jedis.flushAll();
        jedis.quit();
        jedis.disconnect();

        List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
        shards.add(new JedisShardInfo("localhost"));
        Config config = new Config();
        Seek.configure(config, shards);

        Seek seek = new Seek();
View Full Code Here

TOP

Related Classes of redis.clients.jedis.JedisShardInfo

Copyright © 2018 www.massapicom. 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.