From a090abc9a4620c3ba3ca1edc228e893676ec15a5 Mon Sep 17 00:00:00 2001 From: LamGC Date: Tue, 12 Jan 2021 06:39:48 +0800 Subject: [PATCH] =?UTF-8?q?[Change]=20CacheStore-API,=20CacheStore-Local,?= =?UTF-8?q?=20CacheStore-Redis=20=E8=B0=83=E6=95=B4=20MapCacheStore.putAll?= =?UTF-8?q?=20=E6=96=B9=E6=B3=95=E5=8F=82=E6=95=B0;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Change] MapCacheStore 调整 'putAll' 方法的泛型, 以兼容类型的子类; [Change] HashMapCacheStore, RedisMapCacheStore 适配更改; --- .../src/main/java/net/lamgc/cgj/bot/cache/MapCacheStore.java | 2 +- .../java/net/lamgc/cgj/bot/cache/local/HashMapCacheStore.java | 2 +- .../java/net/lamgc/cgj/bot/cache/redis/RedisMapCacheStore.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/MapCacheStore.java b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/MapCacheStore.java index ff7c78d..abe1ceb 100644 --- a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/MapCacheStore.java +++ b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/MapCacheStore.java @@ -67,7 +67,7 @@ public interface MapCacheStore extends CacheStore> { * @return 如果成功返回 true. * @throws NullPointerException 当 key/map 为 null 时抛出, 缓存存储容器不允许出现 null 值. */ - boolean putAll(CacheKey key, Map map); + boolean putAll(CacheKey key, Map map); /** * 如果字段不存在, 则会将指定的值与此映射中的指定字段关联. diff --git a/ContentGrabbingJi-CacheStore-local/src/main/java/net/lamgc/cgj/bot/cache/local/HashMapCacheStore.java b/ContentGrabbingJi-CacheStore-local/src/main/java/net/lamgc/cgj/bot/cache/local/HashMapCacheStore.java index e231ae1..5cc40f5 100644 --- a/ContentGrabbingJi-CacheStore-local/src/main/java/net/lamgc/cgj/bot/cache/local/HashMapCacheStore.java +++ b/ContentGrabbingJi-CacheStore-local/src/main/java/net/lamgc/cgj/bot/cache/local/HashMapCacheStore.java @@ -56,7 +56,7 @@ public class HashMapCacheStore extends HashCacheStore> impleme } @Override - public boolean putAll(CacheKey key, Map map) { + public boolean putAll(CacheKey key, Map map) { return getMap(key, true, keyMap -> { keyMap.putAll(Objects.requireNonNull(map)); return true; diff --git a/ContentGrabbingJi-CacheStore-redis/src/main/java/net/lamgc/cgj/bot/cache/redis/RedisMapCacheStore.java b/ContentGrabbingJi-CacheStore-redis/src/main/java/net/lamgc/cgj/bot/cache/redis/RedisMapCacheStore.java index c748f48..1bbd56e 100644 --- a/ContentGrabbingJi-CacheStore-redis/src/main/java/net/lamgc/cgj/bot/cache/redis/RedisMapCacheStore.java +++ b/ContentGrabbingJi-CacheStore-redis/src/main/java/net/lamgc/cgj/bot/cache/redis/RedisMapCacheStore.java @@ -107,7 +107,7 @@ public class RedisMapCacheStore extends RedisCacheStore> imple } @Override - public boolean putAll(CacheKey key, Map map) { + public boolean putAll(CacheKey key, Map map) { Objects.requireNonNull(key); Objects.requireNonNull(map); if (map.size() == 0) {