| | |
| | | |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | import org.redisson.config.TransportMode; |
| | | import org.redisson.config.ReadMode; |
| | | import org.redisson.config.SubscriptionMode; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | @Component |
| | | @ConfigurationProperties(prefix = "redisson") |
| | | public class RedissonProperties { |
| | | |
| | | /** |
| | | * redis缓存key前缀 |
| | | */ |
| | | private String keyPrefix; |
| | | |
| | | /** |
| | | * 线程池数量,默认值 = 当前处理核数量 * 2 |
| | | */ |
| | | private int threads; |
| | | |
| | | /** |
| | | * 线程池数量,默认值 = 当前处理核数量 * 2 |
| | | */ |
| | | private int threads; |
| | | /** |
| | | * Netty线程池数量,默认值 = 当前处理核数量 * 2 |
| | | */ |
| | | private int nettyThreads; |
| | | |
| | | /** |
| | | * Netty线程池数量,默认值 = 当前处理核数量 * 2 |
| | | */ |
| | | private int nettyThreads; |
| | | /** |
| | | * 单机服务配置 |
| | | */ |
| | | private SingleServerConfig singleServerConfig; |
| | | |
| | | /** |
| | | * 传输模式 |
| | | */ |
| | | private TransportMode transportMode; |
| | | /** |
| | | * 集群服务配置 |
| | | */ |
| | | private ClusterServersConfig clusterServersConfig; |
| | | |
| | | /** |
| | | * 单机服务配置 |
| | | */ |
| | | private SingleServerConfig singleServerConfig; |
| | | /** |
| | | * 缓存组 |
| | | */ |
| | | private List<CacheGroup> cacheGroup; |
| | | |
| | | /** |
| | | * 缓存组 |
| | | */ |
| | | private List<CacheGroup> cacheGroup; |
| | | @Data |
| | | @NoArgsConstructor |
| | | public static class SingleServerConfig { |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | public static class SingleServerConfig { |
| | | /** |
| | | * 客户端名称 |
| | | */ |
| | | private String clientName; |
| | | |
| | | /** |
| | | * 客户端名称 |
| | | */ |
| | | private String clientName; |
| | | /** |
| | | * 最小空闲连接数 |
| | | */ |
| | | private int connectionMinimumIdleSize; |
| | | |
| | | /** |
| | | * 最小空闲连接数 |
| | | */ |
| | | private int connectionMinimumIdleSize; |
| | | /** |
| | | * 连接池大小 |
| | | */ |
| | | private int connectionPoolSize; |
| | | |
| | | /** |
| | | * 连接池大小 |
| | | */ |
| | | private int connectionPoolSize; |
| | | /** |
| | | * 连接空闲超时,单位:毫秒 |
| | | */ |
| | | private int idleConnectionTimeout; |
| | | |
| | | /** |
| | | * 连接空闲超时,单位:毫秒 |
| | | */ |
| | | private int idleConnectionTimeout; |
| | | /** |
| | | * 命令等待超时,单位:毫秒 |
| | | */ |
| | | private int timeout; |
| | | |
| | | /** |
| | | * 命令等待超时,单位:毫秒 |
| | | */ |
| | | private int timeout; |
| | | /** |
| | | * 发布和订阅连接池大小 |
| | | */ |
| | | private int subscriptionConnectionPoolSize; |
| | | |
| | | /** |
| | | * 如果尝试在此限制之内发送成功,则开始启用 timeout 计时。 |
| | | */ |
| | | private int retryAttempts; |
| | | } |
| | | |
| | | /** |
| | | * 命令重试发送时间间隔,单位:毫秒 |
| | | */ |
| | | private int retryInterval; |
| | | @Data |
| | | @NoArgsConstructor |
| | | public static class ClusterServersConfig { |
| | | |
| | | /** |
| | | * 发布和订阅连接的最小空闲连接数 |
| | | */ |
| | | private int subscriptionConnectionMinimumIdleSize; |
| | | /** |
| | | * 客户端名称 |
| | | */ |
| | | private String clientName; |
| | | |
| | | /** |
| | | * 发布和订阅连接池大小 |
| | | */ |
| | | private int subscriptionConnectionPoolSize; |
| | | /** |
| | | * master最小空闲连接数 |
| | | */ |
| | | private int masterConnectionMinimumIdleSize; |
| | | |
| | | /** |
| | | * 单个连接最大订阅数量 |
| | | */ |
| | | private int subscriptionsPerConnection; |
| | | /** |
| | | * master连接池大小 |
| | | */ |
| | | private int masterConnectionPoolSize; |
| | | |
| | | /** |
| | | * DNS监测时间间隔,单位:毫秒 |
| | | */ |
| | | private int dnsMonitoringInterval; |
| | | /** |
| | | * slave最小空闲连接数 |
| | | */ |
| | | private int slaveConnectionMinimumIdleSize; |
| | | |
| | | } |
| | | /** |
| | | * slave连接池大小 |
| | | */ |
| | | private int slaveConnectionPoolSize; |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | public static class CacheGroup { |
| | | /** |
| | | * 连接空闲超时,单位:毫秒 |
| | | */ |
| | | private int idleConnectionTimeout; |
| | | |
| | | /** |
| | | * 组id |
| | | */ |
| | | private String groupId; |
| | | /** |
| | | * 命令等待超时,单位:毫秒 |
| | | */ |
| | | private int timeout; |
| | | |
| | | /** |
| | | * 组过期时间 |
| | | */ |
| | | private long ttl; |
| | | /** |
| | | * 发布和订阅连接池大小 |
| | | */ |
| | | private int subscriptionConnectionPoolSize; |
| | | |
| | | /** |
| | | * 组最大空闲时间 |
| | | */ |
| | | private long maxIdleTime; |
| | | /** |
| | | * 读取模式 |
| | | */ |
| | | private ReadMode readMode; |
| | | |
| | | /** |
| | | * 组最大长度 |
| | | */ |
| | | private int maxSize; |
| | | /** |
| | | * 订阅模式 |
| | | */ |
| | | private SubscriptionMode subscriptionMode; |
| | | |
| | | } |
| | | } |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | public static class CacheGroup { |
| | | |
| | | /** |
| | | * 组id |
| | | */ |
| | | private String groupId; |
| | | |
| | | /** |
| | | * 组过期时间 |
| | | */ |
| | | private long ttl; |
| | | |
| | | /** |
| | | * 组最大空闲时间 |
| | | */ |
| | | private long maxIdleTime; |
| | | |
| | | /** |
| | | * 组最大长度 |
| | | */ |
| | | private int maxSize; |
| | | |
| | | } |
| | | |
| | | } |