package com.platform.modules.live.task;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.platform.common.utils.DateUtils;
import com.platform.modules.live.service.LiveSceneCountService;

/**
 * 现场直播预览数定时刷新数据库任务
 * @Author: weiyan
 * @CreateDate: 2019-02-21 
 * 
 */
@Component("sceneCountToDBTask")
public class SceneCountToDBTask {
	
	private Logger logger = LoggerFactory.getLogger(getClass());
	
	@Autowired
	private LiveSceneCountService liveSceneCountService;
	
	public void SceneCountToDBJob(){

		logger.info("现场直播预览数定时刷新数据库任务，刷新时间为：" + DateUtils.format(new Date(),DateUtils.DATE_TIME_PATTERN));
		
		liveSceneCountService.freshRedisSceneCountToDB();
	}
	
	public void CleanRedisSceneCountJob(){

		logger.info("清空redis中现场直播计数任务，刷新时间为：" + DateUtils.format(new Date(),DateUtils.DATE_TIME_PATTERN));
		
		liveSceneCountService.cleanRedisSceneCountJob();
	}
}
