public class CacheConnection
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static AwsWrapperProperty |
CACHE_CONNECTION_POOL_SIZE |
protected static AwsWrapperProperty |
CACHE_CONNECTION_TIMEOUT |
protected static AwsWrapperProperty |
CACHE_IAM_REGION |
protected static AwsWrapperProperty |
CACHE_KEY_PREFIX |
protected static AwsWrapperProperty |
CACHE_NAME |
protected static AwsWrapperProperty |
CACHE_PASSWORD |
protected static AwsWrapperProperty |
CACHE_RO_ENDPOINT_ADDR |
static AwsWrapperProperty |
CACHE_RW_ENDPOINT_ADDR |
protected static AwsWrapperProperty |
CACHE_TLS_CA_CERT_PATH |
protected static AwsWrapperProperty |
CACHE_USE_SSL |
protected static AwsWrapperProperty |
CACHE_USERNAME |
protected static AwsWrapperProperty |
FAIL_WHEN_CACHE_DOWN |
| Constructor and Description |
|---|
CacheConnection(java.util.Properties properties,
@Nullable TelemetryFactory telemetryFactory,
@Nullable FullServicesContainer servicesContainer) |
| Modifier and Type | Method and Description |
|---|---|
protected glide.api.models.configuration.BaseClientConfiguration |
buildClientConfiguration(java.lang.String hostname,
int port,
java.lang.Boolean isRead)
Builds Glide client configuration using instance fields.
|
protected static glide.api.models.configuration.BaseClientConfiguration |
buildClientConfigurationStatic(java.lang.String hostname,
int port,
boolean useSSL,
java.time.Duration connectionTimeout,
boolean iamAuthEnabled,
@Nullable java.lang.String cacheIamRegion,
@Nullable java.lang.String cacheName,
@Nullable java.lang.String cacheUsername,
@Nullable java.lang.String cachePassword,
java.lang.Boolean isRead,
@Nullable java.lang.Boolean isClusterMode,
byte[] caCert)
Builds Glide client configuration for standalone or cluster mode.
|
static void |
clearEndpointPoolRegistry() |
protected void |
decrementInFlightSize(long writeSize) |
protected CacheMonitor.HealthState |
getClusterHealthStateFromCacheMonitor() |
protected void |
handleCompletedCacheWrite(glide.api.BaseClient client,
long writeSize,
java.lang.Throwable ex) |
protected void |
incrementInFlightSize(long writeSize) |
byte[] |
readFromCache(java.lang.String key) |
protected void |
reportErrorToCacheMonitor(boolean isWrite,
java.lang.Throwable error,
java.lang.String operation) |
protected void |
setClusterMode(boolean clusterMode) |
protected void |
setConnectionPools(org.apache.commons.pool2.impl.GenericObjectPool<glide.api.BaseClient> readPool,
org.apache.commons.pool2.impl.GenericObjectPool<glide.api.BaseClient> writePool) |
protected boolean |
shouldProceedWithOperation(CacheMonitor.HealthState state) |
java.lang.String |
toString() |
protected void |
triggerPoolInit(boolean isRead) |
void |
writeToCache(java.lang.String key,
byte[] value,
int expiry) |
public static final AwsWrapperProperty CACHE_RW_ENDPOINT_ADDR
protected static final AwsWrapperProperty CACHE_RO_ENDPOINT_ADDR
protected static final AwsWrapperProperty CACHE_USE_SSL
protected static final AwsWrapperProperty CACHE_TLS_CA_CERT_PATH
protected static final AwsWrapperProperty CACHE_IAM_REGION
protected static final AwsWrapperProperty CACHE_USERNAME
protected static final AwsWrapperProperty CACHE_PASSWORD
protected static final AwsWrapperProperty CACHE_NAME
protected static final AwsWrapperProperty CACHE_CONNECTION_TIMEOUT
protected static final AwsWrapperProperty CACHE_CONNECTION_POOL_SIZE
protected static final AwsWrapperProperty FAIL_WHEN_CACHE_DOWN
protected static final AwsWrapperProperty CACHE_KEY_PREFIX
public CacheConnection(java.util.Properties properties,
@Nullable TelemetryFactory telemetryFactory,
@Nullable FullServicesContainer servicesContainer)
protected glide.api.models.configuration.BaseClientConfiguration buildClientConfiguration(java.lang.String hostname,
int port,
java.lang.Boolean isRead)
hostname - the cache server hostnameport - the cache server portisRead - true for read-only replica connections, false for primary connectionsprotected static glide.api.models.configuration.BaseClientConfiguration buildClientConfigurationStatic(java.lang.String hostname,
int port,
boolean useSSL,
java.time.Duration connectionTimeout,
boolean iamAuthEnabled,
@Nullable java.lang.String cacheIamRegion,
@Nullable java.lang.String cacheName,
@Nullable java.lang.String cacheUsername,
@Nullable java.lang.String cachePassword,
java.lang.Boolean isRead,
@Nullable java.lang.Boolean isClusterMode,
byte[] caCert)
hostname - the cache server hostnameport - the cache server portuseSSL - whether to use TLS for the connectionconnectionTimeout - the connection timeout durationiamAuthEnabled - whether IAM authentication is enabledcacheIamRegion - the AWS region for IAM authenticationcacheName - the cache name for IAM authenticationcacheUsername - the username for cache authenticationcachePassword - the password for cache authenticationisRead - true for read-only replica connections, false for primary connectionsisClusterMode - true for cluster mode (CME), false for standalone mode (CMD)caCert - the CA certificate bytes for TLS, or nullpublic byte[] readFromCache(java.lang.String key)
throws java.sql.SQLException
java.sql.SQLExceptionprotected void handleCompletedCacheWrite(glide.api.BaseClient client,
long writeSize,
java.lang.Throwable ex)
public void writeToCache(java.lang.String key,
byte[] value,
int expiry)
protected CacheMonitor.HealthState getClusterHealthStateFromCacheMonitor()
protected void reportErrorToCacheMonitor(boolean isWrite,
java.lang.Throwable error,
java.lang.String operation)
protected void incrementInFlightSize(long writeSize)
protected void decrementInFlightSize(long writeSize)
protected boolean shouldProceedWithOperation(CacheMonitor.HealthState state)
public java.lang.String toString()
toString in class java.lang.Objectprotected void setConnectionPools(org.apache.commons.pool2.impl.GenericObjectPool<glide.api.BaseClient> readPool,
org.apache.commons.pool2.impl.GenericObjectPool<glide.api.BaseClient> writePool)
protected void triggerPoolInit(boolean isRead)
protected void setClusterMode(boolean clusterMode)
public static void clearEndpointPoolRegistry()