Skip to content

Add fastReplaceValuesAsync and fastReplaceValues to RMultimap and its implementations.#6300

Merged
mrniko merged 1 commit intoredisson:masterfrom
davidreis97:multimap-fast-replace-values
Nov 28, 2024
Merged

Add fastReplaceValuesAsync and fastReplaceValues to RMultimap and its implementations.#6300
mrniko merged 1 commit intoredisson:masterfrom
davidreis97:multimap-fast-replace-values

Conversation

@davidreis97
Copy link
Contributor

Is faster than replaceValues and replaceValuesAsync by not returning the new values.

Closes #6294.

@davidreis97 davidreis97 force-pushed the multimap-fast-replace-values branch from 9c0e13b to 7cb20a6 Compare November 25, 2024 18:21
* @param key - map key
* @param values - map values
*/
void fastReplaceValues(K key, Iterable<? extends V> values);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add these methods to RMultimapRx and RMultimapReactive interfaces as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

return replaceValuesInternal(key, values, false);
}

private <T> RFuture<T> replaceValuesInternal(K key, Iterable<? extends V> values, boolean returnValues) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A separate method is needed without returnValues parameter and "local members = redis.call('lrange', KEYS[2], 0, -1);" usage

Copy link
Contributor Author

@davidreis97 davidreis97 Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer doing SMEMBERS or LRANGE when returnValues == false. Kept the single method approach to try to avoid duplication, but let me know if you still prefer the two separate methods!

Copy link
Member

@mrniko mrniko Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please make a separate method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@davidreis97 davidreis97 force-pushed the multimap-fast-replace-values branch from 7cb20a6 to d699576 Compare November 26, 2024 18:41
return replaceValuesInternal(key, values, false);
}

private <T> RFuture<T> replaceValuesInternal(K key, Iterable<? extends V> values, boolean returnValues) {
Copy link
Member

@mrniko mrniko Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please make a separate method.

@davidreis97 davidreis97 force-pushed the multimap-fast-replace-values branch 3 times, most recently from 2ce062f to dfba402 Compare November 27, 2024 14:10
… implementations.

Is faster than replaceValues and replaceValuesAsync by not returning the new values.

Signed-off-by: David Reis <david.alex.reis.97@gmail.com>
@davidreis97 davidreis97 force-pushed the multimap-fast-replace-values branch from dfba402 to 9a10011 Compare November 27, 2024 14:12
@mrniko mrniko added the feature label Nov 28, 2024
@mrniko mrniko added this to the 3.39.1 milestone Nov 28, 2024
@mrniko mrniko merged commit 5d9a0fc into redisson:master Nov 28, 2024
@mrniko
Copy link
Member

mrniko commented Nov 28, 2024

Thanks for contribution!

@davidreis97 davidreis97 deleted the multimap-fast-replace-values branch November 28, 2024 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

RSetMultimap not creating entry in main structure when getting one of the inner RSet

2 participants