PlayEdu/src/main/java/xyz/playedu/api/caches/UserLastLearnTimeCache.java
2023-04-07 10:03:45 +08:00

31 lines
691 B
Java

/**
* This file is part of the PlayEdu.
* (c) 杭州白书科技有限公司
*/
package xyz.playedu.api.caches;
import org.springframework.stereotype.Component;
import xyz.playedu.api.util.RedisUtil;
/**
* @Author 杭州白书科技有限公司
*
* @create 2023/3/22 13:57
*/
@Component
public class UserLastLearnTimeCache {
private static final String groupName = "user-learn-last-timestamp";
private static final int expire = 9500; // 9.5s
public Long get(Integer userId) {
return (Long) RedisUtil.hGet(groupName, userId + "");
}
public void put(Integer userId, Long timestamp) {
RedisUtil.hSet(groupName, userId + "", timestamp);
}
}