Problem
AsyncRedisCacheBackend.clear_pattern uses pattern if pattern.startswith(self.key_prefix) else self._make_key(pattern). The base contract says patterns match the logical key, and the Memory backend always prefixes.
Reproduced: with AsyncRedisCacheBackend(key_prefix="cache:") and the default CacheManager (whose own prefix is also cache:), clear_pattern("cache:user:*") is sent unprefixed and clears 0 keys, although cache:cache:user:1 exists.
Proposal
- 0.3.8: always prefix. When that clears nothing and the pattern starts with the prefix, retry the legacy form and emit a
DeprecationWarning.
- 0.4.0: remove the fallback (tracked separately).
Problem
AsyncRedisCacheBackend.clear_patternusespattern if pattern.startswith(self.key_prefix) else self._make_key(pattern). The base contract says patterns match the logical key, and the Memory backend always prefixes.Reproduced: with
AsyncRedisCacheBackend(key_prefix="cache:")and the defaultCacheManager(whose own prefix is alsocache:),clear_pattern("cache:user:*")is sent unprefixed and clears 0 keys, althoughcache:cache:user:1exists.Proposal
DeprecationWarning.