package com.diagbot.config;

import com.diagbot.facade.CacheFacade;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @Description: 项目启动后初始化缓存
 * @author: gaodm
 * @time: 2024/5/13 11:20
 */
@Component //把类交给spring容器管理
@Order(100)  //使用order属性，设置该类在spring容器中的加载顺序
@Slf4j
public class CacheDeleteInit implements CommandLineRunner {

    @Autowired
    CacheFacade cacheFacade;

    @Override
    public void run(String... args) throws Exception {
        // 服务启动清除redis缓存
        cacheFacade.clear();
        log.info("病案首页质控系统缓存启动初始化成功！");
    }
}
