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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasString()booleanstatic RedisNodefromString(String hostPortString) Parse ahostAndPortstring intoRedisNode.static RedisNodefromString(String hostPortString, int defaultPort) Parse ahostAndPortstring intoRedisNode.getHost()getId()getName()getPort()getType()inthashCode()booleanbooleanisMaster()booleanstatic RedisNode.RedisNodeBuilderGetRedisNode.RedisNodeBuilderfor creating newRedisNode.voidvoidtoString()
-
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 ahostAndPortstring 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 ahostAndPortstring 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.RedisNodeBuilderfor creating newRedisNode.- Returns:
- never null.
- Since:
- 1.7
-
toString
-
hashCode
public int hashCode() -
equals
-