-
-
Notifications
You must be signed in to change notification settings - Fork 188
Open
Labels
bugSomething isn't workingSomething isn't workingneeds-triageNeeds to be reviewedNeeds to be reviewed
Description
Hi, I ran into an issue where any calls to FastAPICache.clear(key="value") would not work for any given value passed to key. It turns out that even if you don't pass a namespace to the clear function, if you have initialized the connection with a prefix, that prefix is then used to create a namespace:
fastapi-cache/fastapi_cache/__init__.py
Line 102 in 157a913
| namespace = cls._prefix + (":" + namespace if namespace else "") |
That namespace is then passed along with the key to the Redis clear function, where it supersedes the key that you explicitly are trying to clear, and the clear function is run on the prefix-generated namespace instead.
For my purposes it was simple enough to just drop the prefix altogether, but logically initializing the connection with a prefix shouldn't render clearing by key unusable like it is now.
tinchoram
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds-triageNeeds to be reviewedNeeds to be reviewed