DATAREDIS-803 - Retrieve DefaultRedisMap.entrySet() via HGETALL.
Redis has a limitation of 1024 * 1024 parameters]() for bulk operations. To receive more than 1024 * 1024 - 1 entries with entrySet(), we can directly use the HGETALL command instead of first fetching the keys with HKEYS and then fetching the values with HMGET. See also: https://github.com/antirez/redis/blob/4.0.9/src/networking.c#L1200 Original pull request: #326.
This commit is contained in:
committed by
Mark Paluch
parent
cd340448b2
commit
8ed4703d46
@@ -38,6 +38,7 @@ import org.springframework.lang.Nullable;
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Christoph Strobl
|
||||
* @author Christian Bühler
|
||||
*/
|
||||
public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
|
||||
@@ -156,19 +157,9 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
|
||||
@Override
|
||||
public Set<java.util.Map.Entry<K, V>> entrySet() {
|
||||
|
||||
Set<K> keySet = keySet();
|
||||
checkResult(keySet);
|
||||
Collection<V> multiGet = hashOps.multiGet(keySet);
|
||||
|
||||
Iterator<K> keys = keySet.iterator();
|
||||
Iterator<V> values = multiGet.iterator();
|
||||
|
||||
Set<Map.Entry<K, V>> entries = new LinkedHashSet<>();
|
||||
while (keys.hasNext()) {
|
||||
entries.add(new DefaultRedisMapEntry(keys.next(), values.next()));
|
||||
}
|
||||
|
||||
return entries;
|
||||
Map<K, V> entries = hashOps.entries();
|
||||
checkResult(entries);
|
||||
return entries.entrySet();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user