Skip to content

Conversation

@dburyak
Copy link

@dburyak dburyak commented Dec 18, 2025

Implements #502 . Adds support for binary keys in MultiType. Specifically, this is needed for reading binary fields (keys) of HASH-es with HGETALL command.

The approach is to always store elements of multi in multi array, and evaluate corresponding map with string or/and binary keys when either is requested. This approach makes this class NOT thread safe, but it is not a really useful feature since under typical usage scenarios there won't be concurrent access. Hence, it's better to keep this class simple and not-thread-safe, and if the need to use it concurrently arises in some exotic use cases, then let the callers deal with it externally.

NOTE: I had to decide whether to keep using un-ordered HashMap for binary keys too, or change both strMap and binMap to be LinkedHashMap. In fact, Redis preserves order of fields in HASH-es, and relevant commands like HKEYS, HVALS, HSCAN and HGETALL particularly, return values in their respective order. With this change, the existing method MultiType#getKeys() will also preserve order, which was not the case due to usage of HashMap. Even though technically this is a change of behavior, it can not affect any existing users, as they were unable to rely on the order anyway prior to this change.

@tsegismont tsegismont requested a review from Ladicek December 19, 2025 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant