Code snippet optimization
This commit is contained in:
@@ -40,9 +40,9 @@ public abstract class RedisReactiveConfig {
|
|||||||
// this should not be changed unless there is a truely good reason to do so
|
// this should not be changed unless there is a truely good reason to do so
|
||||||
private static final int ps = Runtime.getRuntime().availableProcessors();
|
private static final int ps = Runtime.getRuntime().availableProcessors();
|
||||||
public static final ClientResources clientResources = DefaultClientResources.builder()
|
public static final ClientResources clientResources = DefaultClientResources.builder()
|
||||||
.ioThreadPoolSize(ps)
|
.ioThreadPoolSize(ps)
|
||||||
.computationThreadPoolSize(ps)
|
.computationThreadPoolSize(ps)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
private RedisReactiveProperties redisReactiveProperties;
|
private RedisReactiveProperties redisReactiveProperties;
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ public abstract class RedisReactiveConfig {
|
|||||||
|
|
||||||
public ReactiveRedisConnectionFactory lettuceConnectionFactory() {
|
public ReactiveRedisConnectionFactory lettuceConnectionFactory() {
|
||||||
|
|
||||||
log.info("connect to " + redisReactiveProperties);
|
log.info("connect to {}", redisReactiveProperties);
|
||||||
|
|
||||||
RedisStandaloneConfiguration rcs = new RedisStandaloneConfiguration(redisReactiveProperties.getHost(), redisReactiveProperties.getPort());
|
RedisStandaloneConfiguration rcs = new RedisStandaloneConfiguration(redisReactiveProperties.getHost(), redisReactiveProperties.getPort());
|
||||||
String password = redisReactiveProperties.getPassword();
|
String password = redisReactiveProperties.getPassword();
|
||||||
@@ -65,13 +65,13 @@ public abstract class RedisReactiveConfig {
|
|||||||
}
|
}
|
||||||
rcs.setDatabase(redisReactiveProperties.getDatabase());
|
rcs.setDatabase(redisReactiveProperties.getDatabase());
|
||||||
|
|
||||||
GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
|
GenericObjectPoolConfig<?> poolConfig = new GenericObjectPoolConfig<>();
|
||||||
poolConfig.setMaxTotal(16);
|
poolConfig.setMaxTotal(poolConfig.getMaxTotal() * 2);
|
||||||
LettucePoolingClientConfiguration ccs = LettucePoolingClientConfiguration.builder()
|
LettucePoolingClientConfiguration ccs = LettucePoolingClientConfiguration.builder()
|
||||||
.clientResources(clientResources)
|
.clientResources(clientResources)
|
||||||
.clientOptions(ClientOptions.builder().publishOnScheduler(true).build())
|
.clientOptions(ClientOptions.builder().publishOnScheduler(true).build())
|
||||||
.poolConfig(poolConfig)
|
.poolConfig(poolConfig)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
return new LettuceConnectionFactory(rcs, ccs);
|
return new LettuceConnectionFactory(rcs, ccs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,50 +38,51 @@ public class Dict {
|
|||||||
|
|
||||||
public static final int DELETED = 1;
|
public static final int DELETED = 1;
|
||||||
|
|
||||||
public int isDeleted = 0;
|
public int isDeleted = 0;
|
||||||
|
|
||||||
public int id;
|
public int id;
|
||||||
|
|
||||||
public String key;
|
public String key;
|
||||||
|
|
||||||
public int type;
|
public int type;
|
||||||
|
|
||||||
public String value;
|
public String value;
|
||||||
|
|
||||||
public boolean booleanVal;
|
public boolean booleanVal;
|
||||||
|
|
||||||
public String stringVal;
|
public String stringVal;
|
||||||
|
|
||||||
public BigDecimal numberVal;
|
public BigDecimal numberVal;
|
||||||
|
|
||||||
public int intVal;
|
public int intVal;
|
||||||
|
|
||||||
public long longVal;
|
public long longVal;
|
||||||
|
|
||||||
public float floatVal;
|
public float floatVal;
|
||||||
|
|
||||||
public double doubleVal;
|
public double doubleVal;
|
||||||
|
|
||||||
public String jsonVal;
|
public String jsonVal;
|
||||||
|
|
||||||
public Map<String, Object> valMap;
|
public Map<String, Object> valMap;
|
||||||
|
|
||||||
public List<Object> valList;
|
public List<Object> valList;
|
||||||
|
|
||||||
public long create;
|
public long create;
|
||||||
|
|
||||||
public long update;
|
public long update;
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public Dict(
|
public Dict(
|
||||||
@JsonProperty("isDeleted") int isDeleted,
|
@JsonProperty("isDeleted") int isDeleted,
|
||||||
@JsonProperty("id") int id,
|
@JsonProperty("id") int id,
|
||||||
@JsonProperty("key") String key,
|
@JsonProperty("key") String key,
|
||||||
@JsonProperty("type") int type,
|
@JsonProperty("type") int type,
|
||||||
@JsonProperty("value") String value,
|
@JsonProperty("value") String value,
|
||||||
@JsonProperty("create") long create,
|
@JsonProperty("create") long create,
|
||||||
@JsonProperty("update") long update
|
@JsonProperty("update") long update
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.isDeleted = isDeleted;
|
this.isDeleted = isDeleted;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
@@ -89,6 +90,7 @@ public class Dict {
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
this.create = create;
|
this.create = create;
|
||||||
this.update = update;
|
this.update = update;
|
||||||
|
|
||||||
if (type == BOOLEAN) {
|
if (type == BOOLEAN) {
|
||||||
booleanVal = Boolean.parseBoolean(value);
|
booleanVal = Boolean.parseBoolean(value);
|
||||||
} else if (type == STRING) {
|
} else if (type == STRING) {
|
||||||
|
|||||||
Reference in New Issue
Block a user