package com.qmth.themis.business.cache;

import com.qmth.themis.business.constant.SpringContextHolder;
import com.qmth.themis.business.util.RedisUtil;

/**
 * 考试中数据缓存值操作
 *
 * @Description:
 * @Author: xiatian
 * @Date: 2020-07-29
 */
public class ExamingDataCacheUtil {
    private static RedisUtil redisUtil = SpringContextHolder.getBean(RedisUtil.class);

    public static void deleteUnFinishedRecordId(Long studentId) {
        redisUtil.delete(RedisKeyHelper.unFinishedRecordIdCacheKey(studentId));
    }

    public static void setUnFinishedRecordId(Long studentId, Long examRecordId) {
        redisUtil.set(RedisKeyHelper.unFinishedRecordIdCacheKey(studentId), examRecordId);
    }

    public static Long getUnFinishedRecordId(Long studentId) {
        return (Long) redisUtil.get(RedisKeyHelper.unFinishedRecordIdCacheKey(studentId));
    }

    public static void deleteExamingRecordId(Long studentId) {
        redisUtil.delete(RedisKeyHelper.examingRecordIdCacheKey(studentId));
    }

    public static void setExamingRecordId(Long studentId, Long examRecordId) {
        redisUtil.set(RedisKeyHelper.examingRecordIdCacheKey(studentId), examRecordId);
    }

    public static Long getExamingRecordId(Long studentId) {
        return (Long) redisUtil.get(RedisKeyHelper.examingRecordIdCacheKey(studentId));
    }
}
