package com.qmth.exam.reserve.config;

import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class InitApplyTaskCacheData implements CommandLineRunner {

    private static final Logger log = LoggerFactory.getLogger(InitApplyTaskCacheData.class);

    @Autowired
    private ApplyTaskCacheService applyTaskCacheService;

    @Override
    public void run(String... args) throws Exception {
        log.info("initApplyTaskCacheData start...");
        long startTime = System.currentTimeMillis();
        applyTaskCacheService.initApplyAvailableCountCacheForAllExamSites(true);
        log.info("initApplyTaskCacheData ok... cost:{}ms", System.currentTimeMillis() - startTime);
    }

}
