aio-libs / aio-libs/aiocache

Clear() deletes all Redis keys instead of limiting deletes only to namespace

未關閉
#580 4 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
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 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。