From 3e4b7f114551c25318e182ab2509d5bfe1ad8859 Mon Sep 17 00:00:00 2001 From: LamGC Date: Fri, 17 Apr 2020 15:19:09 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20BotCommandProcess=20=E5=AF=B9IllustP?= =?UTF-8?q?reLoadData=E6=9B=B4=E6=8D=A2=E7=BC=93=E5=AD=98=E7=BB=84?= =?UTF-8?q?=E4=BB=B6(JsonRedisCacheStore=20->=20HotDataCacheStore);=20[Upd?= =?UTF-8?q?ate]=20BotCommandProcess=20=E8=A1=A5=E5=85=85Javadoc;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/net/lamgc/cgj/bot/BotCommandProcess.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java b/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java index 62224a5..448740f 100644 --- a/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java +++ b/src/main/java/net/lamgc/cgj/bot/BotCommandProcess.java @@ -50,7 +50,9 @@ public class BotCommandProcess { private final static Hashtable imageCache = new Hashtable<>(); private final static CacheStore illustInfoCache = new JsonRedisCacheStore(BotEventHandler.redisServer, "illustInfo", gson); - private final static CacheStore illustPreLoadDataCache = new JsonRedisCacheStore(BotEventHandler.redisServer, "illustPreLoadData", gson); + private final static CacheStore illustPreLoadDataCache = new HotDataCacheStore<>( + new JsonRedisCacheStore(BotEventHandler.redisServer, "illustPreLoadData", gson), + new LocalHashCacheStore<>(), 3600000, 900000); private final static CacheStore searchBodyCache = new JsonRedisCacheStore(BotEventHandler.redisServer, "searchBody", gson); private final static CacheStore> rankingCache = new JsonObjectRedisListCacheStore(BotEventHandler.redisServer, "ranking", gson); private final static CacheStore> pagesCache = new RedisPoolCacheStore>(BotEventHandler.redisServer, "imagePages") { @@ -559,6 +561,14 @@ public class BotCommandProcess { return illustInfoObj; } + /** + * 获取作品预加载数据. + * 可以获取作品的一些与用户相关的信息 + * @param illustId 作品Id + * @param flushCache 是否刷新缓存 + * @return 成功返回JsonObject对象 + * @throws IOException 当Http请求处理发生异常时抛出 + */ public static JsonObject getIllustPreLoadData(int illustId, boolean flushCache) throws IOException { String illustIdStr = buildSyncKey(Integer.toString(illustId)); JsonObject result = null;