You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The class is abstract, but could be easily an interface (raised by @prepor)
Users have to create a byte[]. This is not explicitly necessary. All encoded values are written into a nio ByteBuffer, so only a source for bytes is needed (raised by @beckje01)
Constraints of the improved API:
Break as little as possible and preserve RedisCodec as much as possible
Change the connect() methods in a compatible way
Proposed change:
Introduce a new abstraction of RedisCodec that returns ByteBuffer on encode Another abstraction requires to change all API's where RedisCodec is referenced. Plan B: Turn RedisCodec into an interface
Adopt existing codecs
Explain migration in the 3.x to 4.x migration guide
Why ByteBuffer? ByteBuffers are handles to memory and encapsulate data. Netty's ByteBufs work internally with ByteBuffers and can produce references to the data without actually duplicating it. ByteBuffer is used already in RedisCodec.
The text was updated successfully, but these errors were encountered:
I think it looks good and eliminates the byte duplication that was required with the byte[] at the codec stage. Also all for switching it to an interface, looks nice and clean.
The Codec API is based on
RedisCodec
which defines methods to encode and decode keys and values. The class has following issues:encode
returnsbyte[]
whereasdecode
acceptsByteBuffer
byte[]
. This is not explicitly necessary. All encoded values are written into a nioByteBuffer
, so only a source for bytes is needed (raised by @beckje01)Constraints of the improved API:
connect()
methods in a compatible wayProposed change:
Introduce a new abstraction ofAnother abstraction requires to change all API's whereRedisCodec
that returnsByteBuffer
onencode
RedisCodec
is referenced. Plan B: TurnRedisCodec
into an interfaceWhy
ByteBuffer
?ByteBuffer
s are handles to memory and encapsulate data. Netty'sByteBuf
s work internally withByteBuffer
s and can produce references to the data without actually duplicating it.ByteBuffer
is used already inRedisCodec
.The text was updated successfully, but these errors were encountered: