Different types hash key and field for hget and friends #2094
Replies: 3 comments
-
The possibility to have everything be just ByteBuffer to be able to do all serialization/deserialization manually would also be nice. |
Beta Was this translation helpful? Give feedback.
-
See #2801 |
Beta Was this translation helpful? Give feedback.
-
IMHO this is the best approach, if you are consuming the Lettuce driver directly (without the use of an object mapping framework).
Can you elaborate more on this, not sure I understand you correctly. Another possibility to have different types for a key and the field name is to follow the suggestion that @mp911de gave and use dynamic Redis command interfaces. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone.
I'm using JSON strings for the hash fields, while the key of the hash is a plain string.
Currently
RedisHashAsyncCommands
only has one type parameterK
for the key type and all the hash operations use the key typeK
for both the key parameter as well as the field parameter.hget
for example looks like this:RedisFuture<V> hget(K key, K field)
.My current workaround is to use
ByteBuffer
asK
and to manually apply different serialization to key and field. Is there a better way to do this? Spring's redis abstractions allow to get a version of the hash commands scoped to a key that can have a different type for the fields. Something like that would work great, but I don't know how that would integrate into the current RedisCodec infrastructure, since we'd now need a third dynamic codec besides the ones for key and value.Beta Was this translation helpful? Give feedback.
All reactions