All Downloads are FREE. Search and download functionalities are using the official Maven repository.

matrix.boot.redis.properties.RedisProperties Maven / Gradle / Ivy

There is a newer version: 2.1.10
Show newest version
package matrix.boot.redis.properties;

import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.io.Serializable;

/**
 * redis配置类
 *
 * @author WangCheng
 */
@ConfigurationProperties(prefix = "matrix.redis")
@Data
@Accessors(chain = true)
public class RedisProperties {

    /**
     * 是否开启
     */
    private boolean enabled = false;

    /**
     * 是否开启redisson
     */
    private boolean redisson = false;

    /**
     * 默认超时时间
     */
    private Long defaultExpire = 7200L;

    /**
     * redis最大连接数
     */
    private Integer maxTotal = 50;

    /**
     * 链接超时时间
     */
    private Long timeout = 10L;

    /**
     * 单机模式
     */
    private Standalone standalone = new Standalone();

    /**
     * 哨兵模式
     */
    private Sentinel sentinel = new Sentinel();

    /**
     * 集群模式
     */
    private Cluster cluster = new Cluster();

    /**
     * 单机模式配置
     */
    @Data
    @Accessors(chain = true)
    public static class Standalone implements Serializable {

        /**
         * 是否开启单机模式
         */
        private boolean enabled = false;

        /**
         * redis服务器地址
         */
        private String host;

        /**
         * redis服务器端口
         */
        private String port;

        /**
         * redis服务器密码
         */
        private String password;

        /**
         * redis数据库索引
         */
        private Integer database;
    }

    /**
     * 哨兵模式配置
     */
    @Data
    @Accessors(chain = true)
    public static class Sentinel implements Serializable {

        /**
         * 是否开启哨兵模式
         */
        private boolean enabled = false;

        /**
         * 主节点地址
         */
        private String master;

        /**
         * 节点地址,例:0.0.0.0:6379,0.0.0.1:6379
         */
        private String nodes;

        /**
         * redis服务器密码
         */
        private String password;

        /**
         * redis数据库索引
         */
        private Integer database;
    }

    /**
     * 集群配置
     */
    @Data
    @Accessors(chain = true)
    public static class Cluster implements Serializable {

        /**
         * 是否开启集群模式
         */
        private boolean enabled = false;

        /**
         * 节点地址,例:0.0.0.0:6379,0.0.0.1:6379
         */
        private String nodes;

        /**
         * redis服务器密码
         */
        private String password;

        /**
         * 最大转发次数
         */
        private Integer maxRedirects = 3;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy