feat(redis)!: remove the clear_pattern prefix fallback and the encoding option - #401
Merged
Merged
Conversation
A Redis clear_pattern() pattern now always matches the logical key; one that starts with the backend key_prefix is no longer retried with the prefix stripped, and the DeprecationWarning is gone. Closes #125
AsyncRedisCacheBackend creates its client with decode_responses=False and passes replies straight to decode_entry; SCAN keys are decoded as UTF-8 (a key that is not UTF-8 is skipped when listing or matching by path, and still removed by clear()). The encoding and decode_responses parameters are gone and raise TypeError instead of reaching redis-py through **kwargs; RedisConfig loses its encoding field. Entries were always UTF-8 JSON, so stored data reads back unchanged. Closes #126
allen0099
force-pushed
the
remove/125-126-redis-deprecations
branch
from
September 29, 2026 14:59
a7da2c8 to
d068fd2
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.
Fixes #125. Fixes #126.
#125:
clear_patternprefix fallback0.3.8 made
clear_pattern()match the logical key. The retry with the prefix-stripped pattern, and itsDeprecationWarning, are gone. A pattern that starts withkey_prefixnow matches only logical keys that themselves start with the prefix, the same as on every other backend. The docs indocs/BACKENDS.md(EN and zh-TW) are updated.#126:
encodingoption, raw bytesdecode_responses=False. Replies go straight todecode_entry, which already accepted bytes, saving a decode/encode per hit. The Lua compare scripts behinddelete_if_equals/expire_if_equalsnow receive exactly the bytesset()wrote.get_all_keys/clear_pathbut still removed byclear().encoding=anddecode_responses=passed toAsyncRedisCacheBackendraiseTypeError. Otherwise they would fall through**kwargsinto redis-py and switch decoding back on.decode_responsesnever warned in 0.3.9. It only acceptedTrue, its default, and the migration guide now says so.RedisConfigdrops the field and ignores an oldencodingvalue like any other unknown field.decode_responses=Truestill works.Tests
TypeError, non-ASCII and non-UTF-8 content round-trips, old UTF-8 JSON entries, non-UTF-8 keys, and a decoding caller pool.Changelog:
changelog.d/125.removed.md,changelog.d/126.removed.md.