diff --git a/src/callosum/lower/redis_common.py b/src/callosum/lower/redis_common.py new file mode 100644 index 0000000..bbe5c39 --- /dev/null +++ b/src/callosum/lower/redis_common.py @@ -0,0 +1,12 @@ +def redis_addr_to_url( + value: str | tuple[str, int], + *, + scheme: str = "redis", +) -> str: + match value: + case str(): + return f"{scheme}://{value}" + case (host, port): + return f"{scheme}://{host}:{port}" + case _: + raise ValueError("unrecognized address format", value)