Bundle the transcoder's properties into EVCacheTranscoderProperties#198
Closed
joegoogle123 wants to merge 1 commit into
Closed
Conversation
77d50a3 to
d02b7a1
Compare
…nscoderProperties
Today EVCacheImpl reads the binary-serialization FastProperty inline:
```java
final boolean useBinarySerialization = propertyRepository.get(_appName + ".envelope.binary.serialization.enabled", Boolean.class)
.orElseGet("evcache.envelope.binary.serialization.enabled").orElse(false).get();
this.evcacheValueTranscoder = new EVCacheTranscoder(maxValueSize, ENVELOPE_COMPRESSION_DISABLED, useBinarySerialization);
```
This change introduces an EVCacheTranscoderProperties bundle that owns the
read and exposes the result behind a typed accessor. Each property follows a
uniform three-level resolution chain:
1. <appName>.<appSuffix> (per-app override)
2. <globalKey> (fleet-wide global)
3. compiled-in static default
Today the bundle holds exactly one property — USE_BINARY_SERIALIZATION,
appSuffix `binary.serialization.enabled`, globalKey
`default.evcache.binary.serialization.enabled`. The Key enum is the
extension point: new transcoder properties land here and inherit the same
chain without touching the call sites.
EVCacheTranscoder gains a (int, int, EVCacheTranscoderProperties) ctor that
stores the bundle and consults `properties.isBinarySerializationEnabled()`
inside `serialize()`. The old (int, int, boolean) ctor is gone; the 2-arg
(int, int) ctor constructs a properties object with appName=null so the
no-app callers naturally fall through to the global key.
EVCacheImpl drops the inline read and the ENVELOPE_COMPRESSION_DISABLED
constant, building the bundle once per app.
NOTE on property key naming: the global key changed from
`evcache.envelope.binary.serialization.enabled` to
`default.evcache.binary.serialization.enabled`, matching the
`default.evcache.…` convention used by the other transcoder properties.
The per-app suffix is `binary.serialization.enabled` (no `envelope.`
prefix). Any caller who set the old global key will need to migrate.
Future fields that need runtime-dynamic reads can call the bundle's
`getProperty(Key, Class, default)` method instead of caching at
construction. PR #197's setCompressionAlgorithmProperty /
setCompressionLevelProperty setters on EVCacheSerializingTranscoder are
orthogonal and untouched here.
Tests: 5 new tests in EVCacheTranscoderPropertiesTest cover per-app
override, global fallback, static default, per-app-beats-global precedence,
and null-appName routing to the global key.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
d02b7a1 to
7130343
Compare
Author
|
Folding the transcoder-properties commit into PR #196; we'll squash at merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Route the
EVCacheValuebinary-serialization toggle through a newEVCacheTranscoderPropertiesbundle instead of an inlinepropertyRepository.get(...).get()chain inEVCacheImpl. The bundle is a typed extension point — every property it exposes resolves through the same three-level chain, and new transcoder properties land on theKeyenum without touching call sites.What changed
EVCacheTranscoderProperties(com.netflix.evcache.config): holds the bundle.Keyenum carries both the per-app suffix and the global key per property. Constructor(String appName, PropertyRepository propertyRepository)snapshots every property at construction. Today's only entry isUSE_BINARY_SERIALIZATION— additional transcoder properties drop in here.EVCacheTranscodernow has a(int max, int compressionThreshold, EVCacheTranscoderProperties properties)ctor that stores the bundle and consultsproperties.isBinarySerializationEnabled()insideserialize(). The previous(int, int, boolean)ctor is removed; the(int, int)ctor builds a bundle withappName=nullso no-app callers fall through to the global key.EVCacheImpldrops the inline<app>.envelope.binary.serialization.enabledread and theENVELOPE_COMPRESSION_DISABLEDconstant, building the bundle once per app.Three-level resolution
Per property, resolved at construction:
<appName>.<appSuffix>— per-app override<globalKey>— fleet-wide globalFor
USE_BINARY_SERIALIZATION: appSuffixbinary.serialization.enabled, globalKeydefault.evcache.binary.serialization.enabled, defaultfalse.Property-key rename⚠️
This PR renames the FastProperty introduced in #196:
<app>.envelope.binary.serialization.enabled<app>.binary.serialization.enabledevcache.envelope.binary.serialization.enableddefault.evcache.binary.serialization.enabledRationale: align the global key with the
default.evcache.…convention used by the other transcoder properties, and drop theenvelope.prefix that was implicit-already (the transcoder is the envelope codec). Any caller who set the old keys will need to migrate.Dynamic-property escape hatch
Future fields that need runtime mutability can skip the cached primitive and call
EVCacheTranscoderProperties#getProperty(Key, Class, defaultValue)per access — the same three-level chain applies. PR #197'ssetCompressionAlgorithmProperty/setCompressionLevelPropertysetters onEVCacheSerializingTranscoderare orthogonal and untouched here.Stacked on
Base is
evcache-value-binary-serde(PR #196). When #196 merges, this PR's base auto-updates tomaster.Test plan
./gradlew :evcache-core:test— green. Five new tests inEVCacheTranscoderPropertiesTest:joelee-sample-appsmoke test against a republished snapshot. The smoke test's@TestPropertySourcewill need updating to the renamed property keys.🤖 Generated with Claude Code