Make key encoder optional and remove default implementation#82
Merged
Conversation
This was referenced Mar 16, 2026
Member
Author
b947f0b to
dee32d0
Compare
1d8d11b to
35c7d13
Compare
dee32d0 to
96943d7
Compare
35c7d13 to
285cfef
Compare
96943d7 to
e04597e
Compare
6e3b2d9 to
6ed12d6
Compare
e04597e to
03324e8
Compare
xmartinez
approved these changes
Mar 26, 2026
xmartinez
left a comment
There was a problem hiding this comment.
LG! Just a nit re: version mismatch.
6ed12d6 to
51da0e9
Compare
03324e8 to
314d081
Compare
51da0e9 to
6ceea8d
Compare
6ceea8d to
22fea2e
Compare
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.

Remove default key encoder and make key encoding optional
This change removes the
default_key_encoderfunction and makes key encoding optional throughout the codebase. Thekey_encoder_fnparameter inCacheClientandDefaultExecutoris nowOptional[Callable[[Key], bytes]]instead of having a default implementation.When no key encoder is provided, the executor now passes the raw key string directly to the underlying socket layer, which handles key encoding internally. This simplifies the API by removing the need for a default key encoding strategy at the client level. It also makes the socket api more reliable and easy to use, as it handles large keys, binary, unicode all transparently.
We still prove the ability to use your own encoding for backwards compatibility, if you need to match existing behavior. As long as the key encoder returns small ascii keys, the socket endoder will not change the keys any further.
The change affects:
default_key_encoderfunction and related importskey_encoder_fnoptionalPerformance