添加搜索模块,热搜前十,个人搜索记录,搜索记录添加,搜索记录删除,敏感词替换,redis配置没添加
This commit is contained in:
23
src/main/java/com/lovenav/utils/RedisKeyUtils.java
Normal file
23
src/main/java/com/lovenav/utils/RedisKeyUtils.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.lovenav.utils;
|
||||
|
||||
public class RedisKeyUtils {
|
||||
/** * 分隔符号 */
|
||||
private static final String SPLIT = ":";
|
||||
private static final String SEARCH = "search";
|
||||
private static final String SEARCH_HISTORY = "search-history";
|
||||
private static final String HOT_SEARCH = "hot-search";
|
||||
private static final String SEARCH_TIME = "search-time";
|
||||
/** * 每个用户的个人搜索记录hash */
|
||||
public static String getSearchHistoryKey(String userId){
|
||||
return SEARCH + SPLIT + SEARCH_HISTORY + SPLIT + userId;
|
||||
}
|
||||
/** * 总的热搜zset */
|
||||
public static String getHotSearchKey(){
|
||||
return SEARCH + SPLIT + HOT_SEARCH;
|
||||
}
|
||||
/** * 每个搜索记录的时间戳记录:key-value */
|
||||
public static String getSearchTimeKey(String searchKey){
|
||||
return SEARCH + SPLIT + SEARCH_TIME + SPLIT + searchKey;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user