Skip to content
Bluetape4k docs1.11

Codecs, security, and wire format

Latest stable Based on Bluetape4k release 1.11.0

Changing a codec changes bytes stored under existing Redis keys. It is a schema migration that affects rolling deploys and rollback, not merely a performance toggle. Every producer and consumer of a cache name must agree on key and value codecs.

Purpose1.11.0 optionBoundary
General internal objectsRedissonCodecs.ForyUnsupported values may use Kryo5 fallback.
Ephemeral high-throughput cacheFastForyCodec, LZ4FastForyOld Fory readers cannot read FastFory bytes.
Inspectable JSONJackson3CodecManage the type envelope and package allow-list.
JSONBFastjson2CodecValidate class names before class loading.
Compressed valuesLZ4, Zstd, Snappy, or GZip wrapperMeasure CPU and bound decompressed size.

Without allowedPackagePrefixes, Jackson3Codec and Fastjson2Codec accept all class names and allow fallback decode. Narrow the prefixes when tenants or services share Redis.

val codec = Jackson3Codec(
allowedPackagePrefixes = setOf("com.acme.billing."),
)

With an allow-list, non-JSON binary fallback is disabled by default and fails with SecurityException. Enable allowFallbackDecode only for a bounded trusted migration.

FastForyCodec can fall back to the old Fory codec when reading old data. Old ForyCodec readers cannot decode new FastFory bytes. Deploy readers that understand the old format first, then switch writers, and remove old readers last. Delay the write-format switch when rollback must remain safe.

GzipCodec accepts maxDecompressedSize and rejects excessive expansion or corrupt gzip data.

val codec = GzipCodec(
innerCodec = RedissonCodecs.Fory,
maxDecompressedSize = 16 * 1024 * 1024,
)

Set the limit from measured p99 payload size. Do not replace decode failures with empty values.

Codec benchmark results depend on payloads, JVM, CPU, and library versions. Rerun them with domain objects instead of copying a fixed ranking. Wire compatibility and trust boundaries come before throughput.