-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Cache invalidation because of patter matching never happens in RedisStorage
To Reproduce
Steps to reproduce the behavior:
- Setup cache middlware with Redis storage, add CacheDropConfig with some invalidation pattern matched the route
- Fill the cache, by requesting GET-routes matched the invalidation pattern
- Invalidate cache by using POST/PUT?PATCH-routes, macthed the invalidation pattern
- See "The search did not find any matches"
Expected behavior
In InMemoryStorage we use filtering by value to collect keys to delete. It allows to compare invalidation pattern and route.
# Find all keys matching path pattern
keys_to_remove = []
for key, (_, request, _) in self._storage.items():
if path.match(request.url.path):
keys_to_remove.append(key)
In RedisStorage we filters raw keys which are hashed values and don't contain any routes paths.
pattern = self._full_key(str(raw.rstrip("$") + "/*"))
logger.debug(f"Removing key: %s", pattern)
result = await self._storage.scan(match=pattern)
Environment:
- OS: Windows 10
- Python version: 3.11.0
- FastCacheMiddleware version: 0.0.6
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working