[Change] CacheStore-API, CacheStore-Local, CacheStore-Redis 调整 MapCacheStore.putAll 方法参数;

[Change] MapCacheStore 调整 'putAll' 方法的泛型, 以兼容类型的子类;
[Change] HashMapCacheStore, RedisMapCacheStore 适配更改;
This commit is contained in:
LamGC 2021-01-12 06:39:48 +08:00
parent edb709fb0d
commit a090abc9a4
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D
3 changed files with 3 additions and 3 deletions

View File

@ -67,7 +67,7 @@ public interface MapCacheStore<V> extends CacheStore<Map<String, V>> {
* @return 如果成功返回 true. * @return 如果成功返回 true.
* @throws NullPointerException key/map null 时抛出, 缓存存储容器不允许出现 null . * @throws NullPointerException key/map null 时抛出, 缓存存储容器不允许出现 null .
*/ */
boolean putAll(CacheKey key, Map<String, V> map); boolean putAll(CacheKey key, Map<? extends String, ? extends V> map);
/** /**
* 如果字段不存在, 则会将指定的值与此映射中的指定字段关联. * 如果字段不存在, 则会将指定的值与此映射中的指定字段关联.

View File

@ -56,7 +56,7 @@ public class HashMapCacheStore<V> extends HashCacheStore<Map<String, V>> impleme
} }
@Override @Override
public boolean putAll(CacheKey key, Map<String, V> map) { public boolean putAll(CacheKey key, Map<? extends String, ? extends V> map) {
return getMap(key, true, keyMap -> { return getMap(key, true, keyMap -> {
keyMap.putAll(Objects.requireNonNull(map)); keyMap.putAll(Objects.requireNonNull(map));
return true; return true;

View File

@ -107,7 +107,7 @@ public class RedisMapCacheStore<V> extends RedisCacheStore<Map<String, V>> imple
} }
@Override @Override
public boolean putAll(CacheKey key, Map<String, V> map) { public boolean putAll(CacheKey key, Map<? extends String, ? extends V> map) {
Objects.requireNonNull(key); Objects.requireNonNull(key);
Objects.requireNonNull(map); Objects.requireNonNull(map);
if (map.size() == 0) { if (map.size() == 0) {