File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 55
66
77@lru_cache (maxsize = None )
8- async def get_modules (conn ) -> List [str ]:
9- modules = await conn .execute_command ("module" , "list" )
10- return [m [1 ] for m in modules ]
11-
8+ async def check_for_command (conn , cmd ):
9+ cmd_info = await conn .execute_command ("command" , "info" , cmd )
10+ return not None in cmd_info
1211
1312@lru_cache (maxsize = None )
1413async def has_redis_json (conn = None ):
1514 if conn is None :
1615 conn = get_redis_connection ()
17- names = await get_modules (conn )
18- return b"ReJSON" in names or "ReJSON" in names
19-
16+ command_exists = await check_for_command (conn , "json.set" )
17+ return command_exists
2018
2119@lru_cache (maxsize = None )
2220async def has_redisearch (conn = None ):
2321 if conn is None :
2422 conn = get_redis_connection ()
2523 if has_redis_json (conn ):
2624 return True
27- names = await get_modules (conn )
28- return b"search" in names or "search" in names
25+ command_exists = await check_for_command (conn , "ft.search" )
26+ return command_exists
You can’t perform that action at this time.
0 commit comments