-
Notifications
You must be signed in to change notification settings - Fork 158
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
Clear() method with 'namespace' parameter fails: TypeError: delete() missing 1 required positional argument: 'key' #472
Comments
thanks for reporting @AbuSM, could you please post the error traceback you get when this happens? |
Anyway, checking code for aioredis in https://github.com/aio-libs/aioredis/blob/master/aioredis/commands/generic.py#L10 I would say you are right. If you could open a PR and also add corresponding tests I would be happy to merge :) |
Hi, @argaen! Here is traceback:
I'll open PR with tests as soon as possible :) |
Hi,the reason is maybe in # in decorators.py,line 80-89
def __call__(self, f):
if self.alias:
self.cache = caches.get(self.alias)
else:
self.cache = _get_cache(
cache=self._cache,
serializer=self._serializer,
plugins=self._plugins,
**self._kwargs
) so the method to fix it may to add # in decorators.py,line 80-89
def __call__(self, f):
if self.alias:
self.cache = caches.get(self.alias,**self._kwargs)
else:
self.cache = _get_cache(
cache=self._cache,
serializer=self._serializer,
plugins=self._plugins,
**self._kwargs
) |
@long2ice Great achievement! I didn't look at the root of the problem. Have you tested it? Sure you might write some tests and make a PR. Think this will help to whole project, not only to |
@AbuSM Yes,I make some changes in my fork,but I am not sure if it's right and appropriate or not,that's appreciative if you can review https://github.com/long2ice/aiocache/commits/master and give some suggestions,then I will complete it and make tests,and give a pull request. |
If you create a PR, even as a draft, we'll take a look and provide feedback. |
I want to use certain namespace while cleaning redis cache, like below:
coros.append(asyncio.ensure_future(cache.clear(namespace='main')))
Error occured when redis cache doesn't have key with
namespace
'main' :coros.append(asyncio.ensure_future(cache.clear(namespace='dialog_api')))
I've found the problem in file aiocache/backends/redis.py in 187 line:
So, I want to fix it by adding if statement, like:
I could be wrong or miss something, if anybody faced with it please comment
The text was updated successfully, but these errors were encountered: