一系列接口
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user