Return null elements for absent keys using reactive MGET.
We now use correctly null to indicate absent keys when using reactive MGET. Previously, we used an empty byte buffer that could be incorrectly translated to an empty string when using the string codec. An empty byte buffer can also be returned if the value length is zero leading to a state that doesn't allow distinguishing between absence and empty value. Closes #2402
This commit is contained in:
@@ -202,7 +202,7 @@ public class LettuceReactiveStringCommandsIntegrationTests extends LettuceReacti
|
||||
Mono<List<ByteBuffer>> result = connection.stringCommands()
|
||||
.mGet(Arrays.asList(KEY_1_BBUFFER, KEY_2_BBUFFER, KEY_3_BBUFFER));
|
||||
|
||||
assertThat(result.block()).containsExactly(VALUE_1_BBUFFER, ByteBuffer.allocate(0), VALUE_3_BBUFFER);
|
||||
assertThat(result.block()).containsExactly(VALUE_1_BBUFFER, null, VALUE_3_BBUFFER);
|
||||
}
|
||||
|
||||
@ParameterizedRedisTest // DATAREDIS-525
|
||||
|
||||
@@ -306,13 +306,6 @@ public class DefaultReactiveValueOperationsIntegrationTests<K, V> {
|
||||
V value2 = valueFactory.instance();
|
||||
V absentValue = null;
|
||||
|
||||
if (serializer instanceof StringRedisSerializer) {
|
||||
absentValue = (V) "";
|
||||
}
|
||||
if (value1 instanceof ByteBuffer) {
|
||||
absentValue = (V) ByteBuffer.wrap(new byte[0]);
|
||||
}
|
||||
|
||||
Map<K, V> map = new LinkedHashMap<>();
|
||||
map.put(key1, value1);
|
||||
map.put(key2, value2);
|
||||
|
||||
Reference in New Issue
Block a user