package com.qmth.themis.business.cache;

import com.qmth.themis.business.cache.bean.ExamActivityRecordCacheBean;
import com.qmth.themis.business.constant.SpringContextHolder;
import com.qmth.themis.business.util.RedisUtil;

/**
 * 场次-考试记录hash值操作
 *
 * @Description:
 * @Author: xiatian
 * @Date: 2020-07-29
 */
public class ExamActivityRecordCacheUtil {
    private static RedisUtil redisUtil = SpringContextHolder.getBean(RedisUtil.class);

    public static void removeActivityRecordCache(Long activityId, Long examRecordId) {
        redisUtil.delete(RedisKeyHelper.examActivityRecordCacheKey(activityId), examRecordId.toString());
    }

    public static void setExamRecordStatus(Long activityId, Long examRecordId, ExamActivityRecordCacheBean examActivityRecordCacheBean) {
        redisUtil.set(RedisKeyHelper.examActivityRecordCacheKey(activityId), examRecordId.toString(), examActivityRecordCacheBean);
    }

    public static ExamActivityRecordCacheBean getExamRecordStatus(Long activityId, Long examRecordId) {
        return (ExamActivityRecordCacheBean) redisUtil.get(RedisKeyHelper.examActivityRecordCacheKey(activityId),
                examRecordId.toString());
    }
}
