public interface ToByteBufEncoder<K,V>
ByteBuf. This encoder does not allocate buffers, it just
encodes data to existing buffers.
Classes implementing ToByteBufEncoder are required to implement RedisCodec as well. You should implement also
the RedisCodec.encodeKey(Object) and RedisCodec.encodeValue(Object) methods to ensure compatibility for users
that access the RedisCodec API only.
| Modifier and Type | Method and Description |
|---|---|
void |
encodeKey(K key,
ByteBuf target)
Encode the key for output to redis.
|
void |
encodeValue(V value,
ByteBuf target)
Encode the value for output to redis.
|
int |
estimateSize(Object keyOrValue)
Estimates the size of the resulting byte stream.
|
default boolean |
isEstimateExact()
Returns
true if estimateSize(Object) returns exact size This is used as an optimization to reduce memory
allocations when encoding data. |
void encodeKey(K key, ByteBuf target)
key - the key, may be null.target - the target buffer, must not be null.void encodeValue(V value, ByteBuf target)
value - the value, may be null.target - the target buffer, must not be null.int estimateSize(Object keyOrValue)
keyOrValue - the key or value, may be null.default boolean isEstimateExact()
true if estimateSize(Object) returns exact size This is used as an optimization to reduce memory
allocations when encoding data.true if estimateSize(Object) returns exact size.Copyright © 2025 lettuce.io. All rights reserved.