package org.craft.atom.redis.api;

import org.craft.atom.redis.DefaultRedis;

/**
 * @author mindwind
 * @version 1.0, Apr 19, 2014
 */
public class RedisBuilder extends AbstractRedisBuilder<Redis> {
	
	
	private String host;
	private int    port;

	
	public RedisBuilder(String host, int port) {
		this.host = host;
		this.port = port;
	}
	
	/**
	 * @param hostport format string e.g. 127.0.0.1:6379
	 */
	public RedisBuilder(String hostport) {
		String[] a = hostport.trim().split(":");
		this.host = a[0];
		this.port = Integer.parseInt(a[1]);
	}
	
	
	@Override
	public Redis build() {
		RedisPoolConfig  poolConfig = new RedisPoolConfig();
		set(poolConfig);
		return new DefaultRedis(host, port, timeoutInMillis, poolConfig, password, database);
	}

}

@@ -383,17 +383,17 @@
 .g. 
-127.0.0.1
+localhost
 :637
@@ -454,24 +454,30 @@
 g%5B%5D a = 
+parse(
 hostport
 .trim().
@@ -472,25 +472,8 @@
 port
-.trim().split(%22:%22
 );%0A%09
@@ -536,16 +536,102 @@
 %0A%09%7D%0A%09%0A%09%0A
+%09static String%5B%5D parse(String hostport) %7B%0A%09%09return hostport.trim().split(%22:%22);%0A%09%7D%0A%09%0A%09%0A
 %09@Overri

fix - forget trim host port string