添加搜索模块,热搜前十,个人搜索记录,搜索记录添加,搜索记录删除,敏感词替换,redis配置没添加

This commit is contained in:
cyk
2023-12-19 21:35:57 +08:00
parent 0721107407
commit 9773f42df7
11 changed files with 1612 additions and 1 deletions

View 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;
}
}