Showing
1 changed file
with
6 additions
and
5 deletions
@@ -256,12 +256,13 @@ public class RedisGwCacheClient implements CacheClient { | @@ -256,12 +256,13 @@ public class RedisGwCacheClient implements CacheClient { | ||
256 | lastResult.put(cacheKeyAndStringMap.get(entry.getKey()), entry.getValue()); | 256 | lastResult.put(cacheKeyAndStringMap.get(entry.getKey()), entry.getValue()); |
257 | } | 257 | } |
258 | 258 | ||
259 | - Map<K, T> apply = nullCacheFun.apply(nullCachekeys); // 执行回调函数去数据库查询未缓存的键值集合 | ||
260 | - setBulk(apply, timeOut, cacheKeyPre, clazz); // 将不在缓存的键值对批量放入缓存 | ||
261 | - for(Map.Entry<K, T> item : apply.entrySet()) { | ||
262 | - lastResult.put(item.getKey(), item.getValue()); | 259 | + if (CollectionUtils.isNotEmpty(nullCachekeys)) { |
260 | + Map<K, T> apply = nullCacheFun.apply(nullCachekeys); // 执行回调函数去数据库查询未缓存的键值集合 | ||
261 | + setBulk(apply, timeOut, cacheKeyPre, clazz); // 将不在缓存的键值对批量放入缓存 | ||
262 | + for(Map.Entry<K, T> item : apply.entrySet()) { | ||
263 | + lastResult.put(item.getKey(), item.getValue()); | ||
264 | + } | ||
263 | } | 265 | } |
264 | - | ||
265 | return lastResult; | 266 | return lastResult; |
266 | } catch (Exception e) { | 267 | } catch (Exception e) { |
267 | LOGGER.warn("getBulk from redis failed!!", e); | 268 | LOGGER.warn("getBulk from redis failed!!", e); |
-
Please register or login to post a comment