Clear() deletes all Redis keys instead of limiting deletes only to namespace
- 主要言語
- Python
- スター
- 1.4k
- フォーク
- 181
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Thank you for a very fast caching solution.
I think there could be an issue with clear method when aiocache is used with Redis.
# environment
1. OS: linux (mint 21 and Rocky 8.5)
2. platform: amd64
3. software stack: FastApi (v0.70.0) on python 3.6, redis (v6.0.16) and keydb (v6.2.1)
4. aiocache versions:
aiocache==0.11.1
aioredis==1.3.1
# how to reproduce
1. create some keys in redis
2. clear aiocache on startup (e.g. within FastApi's __init__) with code:
```python
from fastapi import FastAPI
from asyncio import get_event_loop
from aiocache import Cache
from aiocache.serializers import PickleSerializer
class SomeRestServer(FastAPI):
def __init__(self, title: str = "test api") -> None:
super().__init__(title=title)
self._results_cache = Cache(Cache.REDIS, serializer=PickleSerializer(),
endpoint="127.0.0.1", port=6379, namespace="some_name")
loop = get_event_loop()
task = loop.create_task(self._results_cache.clear(namespace="some_name"))
loop.run_until_complete(task)
```
# expected behavior
3a. keys created in step 1 are available after calling the clear method
# actual behavior
3b. all keys are deleted from redis (no matter if namespace value is passed to clear method or not)
コントリビューションガイド
評価
この issue はまだ評価されていません。