Class RedisNode
java.lang.Object
org.springframework.data.redis.connection.RedisNode
- All Implemented Interfaces:
NamedNode
- Direct Known Subclasses:
RedisClusterNode
,RedisServer
- Since:
- 1.4
- Author:
- Christoph Strobl, Thomas Darimont, Mark Paluch, LeeHyungGeol
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasString()
boolean
static RedisNode
fromString
(String hostPortString) Parse ahostAndPort
string intoRedisNode
.static RedisNode
fromString
(String hostPortString, int defaultPort) Parse ahostAndPort
string intoRedisNode
.getHost()
getId()
getName()
getPort()
getType()
int
hashCode()
boolean
boolean
isMaster()
boolean
static RedisNode.RedisNodeBuilder
GetRedisNode.RedisNodeBuilder
for creating newRedisNode
.void
void
toString()
-
Field Details
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
DEFAULT_SENTINEL_PORT
public static final int DEFAULT_SENTINEL_PORT- See Also:
-
-
Constructor Details
-
RedisNode
- Parameters:
host
- must not be nullport
-
-
RedisNode
protected RedisNode()
-
-
Method Details
-
fromString
Parse ahostAndPort
string intoRedisNode
. Supports IPv4, IPv6, and hostname notations including the port. For example:RedisNode.fromString("127.0.0.1"); RedisNode.fromString("127.0.0.1:6379"); RedisNode.fromString("[aaaa:bbbb::dddd:eeee]"); RedisNode.fromString("[aaaa:bbbb::dddd:eeee]:6379"); RedisNode.fromString("my.redis.server"); RedisNode.fromString("my.redis.server:6379");
- Parameters:
hostPortString
- must not be null or empty.- Returns:
- the parsed
RedisNode
. - Since:
- 2.7.4
-
fromString
Parse ahostAndPort
string intoRedisNode
. Supports IPv4, IPv6, and hostname notations including the port. For example:RedisNode.fromString("127.0.0.1"); RedisNode.fromString("127.0.0.1:6379"); RedisNode.fromString("[aaaa:bbbb::dddd:eeee]"); RedisNode.fromString("[aaaa:bbbb::dddd:eeee]:6379"); RedisNode.fromString("my.redis.server"); RedisNode.fromString("my.redis.server:6379");
- Parameters:
hostPortString
- must not be null or empty.- Returns:
- the parsed
RedisNode
. - Since:
- 3.4
-
getHost
- Returns:
- can be null.
-
hasValidHost
public boolean hasValidHost()- Returns:
- whether this node has a valid host (not null and not empty).
- Since:
- 2.3.8
-
getPort
- Returns:
- can be null.
-
asString
-
getName
-
setName
-
getMasterId
- Returns:
- can be null.
- Since:
- 1.7
-
getId
- Returns:
- can be null.
- Since:
- 1.7
-
setId
- Parameters:
id
-- Since:
- 1.7
-
getType
- Returns:
- can be null.
- Since:
- 1.7
-
isMaster
public boolean isMaster()- Returns:
- Since:
- 1.7
-
isReplica
public boolean isReplica()- Returns:
- Since:
- 2.1
-
newRedisNode
GetRedisNode.RedisNodeBuilder
for creating newRedisNode
.- Returns:
- never null.
- Since:
- 1.7
-
toString
-
hashCode
public int hashCode() -
equals
-