TASK:aida;

This commit is contained in:
shahaibo
2024-06-20 10:27:28 +08:00
parent 1f0439c7f9
commit ad1fa0e4c2
11 changed files with 215 additions and 7 deletions

View File

@@ -200,4 +200,17 @@ public class RedisUtil {
Boolean isMember = redisTemplate.opsForSet().isMember(key, userId.toString());
return isMember != null && isMember;
}
public final static String PORTFOLIO_VIEW_KEY = "portfolio:view:";
public void increaseViewCount(Long portfolioId) {
String key = PORTFOLIO_VIEW_KEY + portfolioId;
redisTemplate.opsForValue().increment(key);
}
public Long getViewCount(Long portfolioId) {
String key = PORTFOLIO_VIEW_KEY + portfolioId;
return redisTemplate.opsForValue().increment(key, 0);
}
}