View Javadoc
1   /**
2    *    Copyright 2015 the original author or authors.
3    *
4    *    Licensed under the Apache License, Version 2.0 (the "License");
5    *    you may not use this file except in compliance with the License.
6    *    You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *    Unless required by applicable law or agreed to in writing, software
11   *    distributed under the License is distributed on an "AS IS" BASIS,
12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *    See the License for the specific language governing permissions and
14   *    limitations under the License.
15   */
16  package org.mybatis.caches.redis;
17  
18  import redis.clients.jedis.JedisPoolConfig;
19  import redis.clients.jedis.Protocol;
20  
21  public class RedisConfig extends JedisPoolConfig {
22  
23  	private String host = Protocol.DEFAULT_HOST;
24  	private int port = Protocol.DEFAULT_PORT;
25  	private int connectionTimeout = Protocol.DEFAULT_TIMEOUT;
26  	private int soTimeout = Protocol.DEFAULT_TIMEOUT;
27  	private String password;
28  	private int database = Protocol.DEFAULT_DATABASE;
29  	private String clientName;
30  
31  	public String getHost() {
32  		return host;
33  	}
34  
35  	public void setHost(String host) {
36  		if (host == null || "".equals(host)) {
37  			host = Protocol.DEFAULT_HOST;
38  		}
39  		this.host = host;
40  	}
41  
42  	public int getPort() {
43  		return port;
44  	}
45  
46  	public void setPort(int port) {
47  		this.port = port;
48  	}
49  
50  	public String getPassword() {
51  		return password;
52  	}
53  
54  	public void setPassword(String password) {
55  		if ("".equals(password)) {
56  			password = null;
57  		}
58  		this.password = password;
59  	}
60  
61  	public int getDatabase() {
62  		return database;
63  	}
64  
65  	public void setDatabase(int database) {
66  		this.database = database;
67  	}
68  
69  	public String getClientName() {
70  		return clientName;
71  	}
72  
73  	public void setClientName(String clientName) {
74  		if ("".equals(clientName)) {
75  			clientName = null;
76  		}
77  		this.clientName = clientName;
78  	}
79  
80  	public int getConnectionTimeout() {
81  		return connectionTimeout;
82  	}
83  
84  	public void setConnectionTimeout(int connectionTimeout) {
85  		this.connectionTimeout = connectionTimeout;
86  	}
87  
88  	public int getSoTimeout() {
89  		return soTimeout;
90  	}
91  
92  	public void setSoTimeout(int soTimeout) {
93  		this.soTimeout = soTimeout;
94  	}
95  
96  }