一系列接口

This commit is contained in:
cyk
2023-12-22 10:35:16 +08:00
parent 1201edf7d5
commit 92960b071b
19 changed files with 967 additions and 51 deletions

View File

@@ -119,7 +119,8 @@ public class RedisServiceImpl implements RedisService {
if (result.size() > HOT_SEARCH_NUMBER) {
break;
}
Long time = Long.valueOf(Objects.requireNonNull(valueOperations.get(val)));
Long time = Long.valueOf(Objects.requireNonNull(valueOperations.get("search:search-time:"+val)));
//返回最近一个月的数据
if ((now - time) < HOT_SEARCH_TIME) {
result.add(val);
@@ -134,7 +135,8 @@ public class RedisServiceImpl implements RedisService {
if (result.size() > HOT_SEARCH_NUMBER) {
break;
}
Long time = Long.valueOf(Objects.requireNonNull(valueOperations.get(val)));
System.out.println(valueOperations.get(val));
Long time = Long.valueOf(Objects.requireNonNull(valueOperations.get("search:search-time:"+val)));
//返回最近一个月的数据
if ((now - time) < HOT_SEARCH_TIME) {
result.add(val);
@@ -186,6 +188,7 @@ public class RedisServiceImpl implements RedisService {
// 没有的话就插入有的话的直接更新add是有就覆盖没有就插入
zSetOperations.incrementScore(RedisKeyUtils.getHotSearchKey(), searchKey, 1);
valueOperations.getAndSet(RedisKeyUtils.getSearchTimeKey(searchKey), String.valueOf(now));
return 1L;
}catch (Exception e){
logger.error("redis发生异常异常原因",e);