Skip to content

Fix delete method in Redis#27

Merged
Nottezz merged 3 commits intomainfrom
26-bug-cache-invalidation-because-of-patter-matching-never-happens-in-redisstorage
Dec 8, 2025
Merged

Fix delete method in Redis#27
Nottezz merged 3 commits intomainfrom
26-bug-cache-invalidation-because-of-patter-matching-never-happens-in-redisstorage

Conversation

@Nottezz
Copy link
Collaborator

@Nottezz Nottezz commented Dec 7, 2025

close #26

Роуты, которые не имели key_func не удалялись через CacheDropConfig. Теперь удаляются обе.

image

@Nottezz Nottezz requested a review from chud0 December 7, 2025 12:56
@Nottezz Nottezz added the bug Something isn't working label Dec 7, 2025

pattern = self._full_key(str(raw.rstrip("$") + "/*"))
logger.debug(f"Removing key: %s", pattern)
async for key in self._storage.scan_iter(match=f"{self._namespace}:*"):
Copy link
Collaborator Author

@Nottezz Nottezz Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделал по-сути аналог как в InMemory. Взял scan_iter для получения ключей, там внутри генератор. Решение в дальнейшем надо будет оптимизировать, так как при больших объёмах данных может упасть производительность.

@Nottezz Nottezz self-assigned this Dec 8, 2025
@Nottezz Nottezz merged commit 28cd405 into main Dec 8, 2025
3 checks passed
@Nottezz Nottezz deleted the 26-bug-cache-invalidation-because-of-patter-matching-never-happens-in-redisstorage branch December 8, 2025 14:44
@Nottezz Nottezz changed the title 26-bug-cache-invalidation-because-of-patter-matching-never-happens-in-redisstorage Fix delete method in Redis Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Cache invalidation because of pattern matching never happens in RedisStorage

2 participants

Comments