-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build_key(key, namespace)
is missing from some modules/classes
#569
Comments
Needs test/reproducer. |
OK, I'll add these tests during the next few days. |
Here is a start...I've added two new tests to "tests/acceptance/test_decorators.py::TestCached" in the
Run these tests:
|
The other changes included in #570 are related to using cache keys that are not strings (notably @Dreamsorcerer if you agree that the |
Tests look reasonable, go ahead and complete the PR.
I was under the impression that cache keys are expected to be strings always.. |
Thanks. Will do.
Yeah, in retrospect I'm seeing that now more than when I started using |
...but I only use the |
Yeah, I suspect it will work in some/many cases, but I don't think it's something we want to actively support. The code seems to assume str keys in many places and I think we'll keep typing support simple if we stick to str. |
I've updated the tests to correctly pass the namespace to |
I needed to update the tests again to use the namespace from the cache fixtures. Otherwise these always overwrite the arbitrary namespace I originally chose for the test. |
After reviewing the motivation for submitting this issue, I think it might be helpful to break this into multiple pieces.
|
All changes to the test suite were included in the |
I think this mostly resolved now, with improvements to come in PRs for v1. Feel free to open new issues to track specific problems, but I suspect you'll cover it all in another PR anyway. |
There are some parts of
aiocache
that do not honornamespace
s. This means thatBaseCache.build_key(key, namespace)
is never called to join thenamespace
with thekey
. The affected modules/classes are:decorators.cached
plugins.HitMissRatioPlugin
backends.memory.SimpleMemoryCache
This affects sharing an
alias
ed cache across multiple@cached
-decorated callables. This currently works only whennamespace==None
.A PR will be submitted shortly.
The text was updated successfully, but these errors were encountered: