DATAREDIS-791 - Disable ifValueNotExists() flag in ReactiveHashCommands.hMSet.
We now no longer set ifValueNotExists() in ReactiveHashCommands.hMSet to always upsert hash entries. Previously, we called HSETNX if hMSet was called with a single tuple which did not overwrite existing entries. Align return value of hMSet to return always true as calling internally HSET returns 1 only on newly set hash fields and setting an existing field resulted previously in false. Original Pull Request: #325
This commit is contained in:
committed by
Christoph Strobl
parent
e0b73c7d75
commit
2902d3fb4a
@@ -120,6 +120,21 @@ public class LettuceReactiveHashCommandsTests extends LettuceReactiveCommandsTes
|
||||
assertThat(nativeCommands.hget(KEY_1, FIELD_2), is(equalTo(VALUE_2)));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-791
|
||||
public void hMSetShouldOverwriteValuesCorrectly() {
|
||||
|
||||
Map<ByteBuffer, ByteBuffer> fieldValues = new LinkedHashMap<>();
|
||||
fieldValues.put(FIELD_1_BBUFFER, VALUE_1_BBUFFER);
|
||||
|
||||
connection.hashCommands().hMSet(KEY_1_BBUFFER, fieldValues).block();
|
||||
|
||||
Map<ByteBuffer, ByteBuffer> overwriteFieldValues = new LinkedHashMap<>();
|
||||
overwriteFieldValues.put(FIELD_1_BBUFFER, VALUE_2_BBUFFER);
|
||||
|
||||
connection.hashCommands().hMSet(KEY_1_BBUFFER, overwriteFieldValues).block();
|
||||
assertThat(nativeCommands.hget(KEY_1, FIELD_1), is(equalTo(VALUE_2)));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-525
|
||||
public void hExistsShouldReturnTrueForExistingField() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user