public abstract class ReadFrom extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
ReadFrom.Nodes
Descriptor of nodes that are available for the current read operation.
|
| Modifier and Type | Field and Description |
|---|---|
static ReadFrom |
ANY
Setting to read from any node.
|
static ReadFrom |
ANY_REPLICA
Setting to read from any replica node.
|
static ReadFrom |
MASTER
Setting to read from the upstream only.
|
static ReadFrom |
MASTER_PREFERRED
Setting to read preferred from the upstream and fall back to a replica if the master is not available.
|
static ReadFrom |
NEAREST
Setting to read from the nearest node.
|
static ReadFrom |
REPLICA
Setting to read from the replica only.
|
static ReadFrom |
REPLICA_PREFERRED
Setting to read preferred from replica and fall back to upstream if no replica is not available.
|
static ReadFrom |
SLAVE
Deprecated.
renamed to
REPLICA. |
static ReadFrom |
SLAVE_PREFERRED
Deprecated.
Renamed to
REPLICA_PREFERRED. |
static ReadFrom |
UPSTREAM
Setting to read from the upstream only.
|
static ReadFrom |
UPSTREAM_PREFERRED
Setting to read preferred from the upstream and fall back to a replica if the upstream is not available.
|
| Constructor and Description |
|---|
ReadFrom() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
isOrderSensitive()
|
static ReadFrom |
regex(Pattern pattern)
Read from any node that has
RedisURI matching with the given pattern. |
static ReadFrom |
regex(Pattern pattern,
boolean orderSensitive)
Read from any node that has
RedisURI matching with the given pattern. |
abstract List<RedisNodeDescription> |
select(ReadFrom.Nodes nodes)
Chooses the nodes from the matching Redis nodes that match this read selector.
|
static ReadFrom |
subnet(String... cidrNotations)
Setting to read from any node in the subnets.
|
static ReadFrom |
valueOf(String name)
Retrieve the
ReadFrom preset by name. |
public static final ReadFrom MASTER
public static final ReadFrom MASTER_PREFERRED
public static final ReadFrom UPSTREAM
public static final ReadFrom UPSTREAM_PREFERRED
public static final ReadFrom REPLICA_PREFERRED
@Deprecated public static final ReadFrom SLAVE_PREFERRED
REPLICA_PREFERRED.public static final ReadFrom REPLICA
@Deprecated public static final ReadFrom SLAVE
REPLICA.public static final ReadFrom NEAREST
public static final ReadFrom ANY
public static final ReadFrom ANY_REPLICA
public static ReadFrom subnet(String... cidrNotations)
cidrNotations - CIDR-block notation strings, e.g., "192.168.0.0/16", "2001:db8:abcd:0000::/52". Must not be
null.ReadFromImpl.ReadFromSubnet.public static ReadFrom regex(Pattern pattern)
RedisURI matching with the given pattern.pattern - regex pattern, e.g., Pattern.compile(".*region-1.*"). Must not be null.ReadFromImpl.ReadFromRegex.public static ReadFrom regex(Pattern pattern, boolean orderSensitive)
RedisURI matching with the given pattern.pattern - regex pattern, e.g., Pattern.compile(".*region-1.*"). Must not be null.orderSensitive - true to attempt reads in the order of hosts returned by select(Nodes);
false to apply randomization.ReadFromImpl.ReadFromRegex.public abstract List<RedisNodeDescription> select(ReadFrom.Nodes nodes)
nodes - set of nodes that are suitable for readingRedisNodeDescriptions that are selected for readingprotected boolean isOrderSensitive()
Copyright © 2021 lettuce.io. All rights reserved.