Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Add REDIS zcard (#14316)

Wang Qi224574831c6a
diff --git a/rag/utils/redis_conn.py b/rag/utils/redis_conn.py
index 960e98af81..e3d5e4b3ea 100644
--- a/rag/utils/redis_conn.py
+++ b/rag/utils/redis_conn.py
@@ -284,6 +284,17 @@ class RedisDB:
self.__open__()
return 0
+ def zcard(self, key: str):
+ try:
+ res = self.REDIS.zcard(key)
+ return res
+ except Exception as e:
+ logging.warning(
+ f"RedisDB.zcard {key} got exception: {e}"
+ )
+ self.__open__()
+ return 0
+
def incrby(self, key: str, increment: int):
return self.REDIS.incrby(key, increment)