package com.cyf.devToolBox.juhe.redis; /** * 聚合数据相关的 Redis key 统一定义,避免散落在各处。 * *
 * juhe:weather:{日期}:{城市}:{未来天数}   天气缓存(带 TTL)
 * juhe:weather:call:{日期}                天气当天调用计数
 * juhe:soup:pool                          每日一句缓存池(Set,永久)
 * juhe:soup:call:{日期}                   每日一句当天调用计数
 * 
* * @author cyf */ public final class JuheRedisKeys { private static final String PREFIX = "juhe:"; private JuheRedisKeys() { } /** 天气缓存 key,按「日期 + 城市 + 未来天数」维度缓存。 */ public static String weather(String date, String city, Integer futureNum) { return PREFIX + "weather:" + date + ":" + city + ":" + futureNum; } /** 天气当天调用计数 key。 */ public static String weatherCallCount(String date) { return PREFIX + "weather:call:" + date; } /** 每日一句缓存池 key(Set,永久存储,用于去重与随机返回)。 */ public static String soupPool() { return PREFIX + "soup:pool"; } /** 每日一句当天调用计数 key。 */ public static String soupCallCount(String date) { return PREFIX + "soup:call:" + date; } }