Codecs and serialization
Latest stable Based on Bluetape4k release 1.11.0
A codec is persisted format
Section titled “A codec is persisted format”LettuceBinaryCodec<V> combines String keys with values produced by a BinarySerializer. LettuceJsonCodec<V> restores JSON to an explicit valueType. The integer and long codecs use fixed-width big-endian values compatible with Redisson primitive codecs.
val codec = LettuceBinaryCodecs.lz4Fory<User>()val connection = LettuceClients.connect(client, codec)connection.sync().set("user:1", User(1, "Alice"))Migrate before changing codecs
Section titled “Migrate before changing codecs”The default binary codec is LZ4+Fory. FastFory is not wire-compatible with Fory, has no fallback, and does not support cyclic object graphs. A codec switch therefore needs a new prefix, dual writes, or a deliberate cache reset.
Untrusted payloads
Section titled “Untrusted payloads”Use object deserializers only for trusted values written by the application. If external actors can modify Redis bytes, narrow Redis permissions and prefer primitives or JSON with an explicit type contract. Compression may cost more than it saves for small values, so benchmark representative payloads.
Source and tests
Section titled “Source and tests”Continue with Maps and cache loading.