From cda570eb374e0d4e3c8247d1a7d92895769e7634 Mon Sep 17 00:00:00 2001 From: profitroll Date: Sun, 9 Feb 2025 23:40:09 +0100 Subject: [PATCH] Changed default URI for Redis --- classes/cache/holo_cache_redis.py | 6 ++---- config_example.json | 2 +- migrations/202502092252.py | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/classes/cache/holo_cache_redis.py b/classes/cache/holo_cache_redis.py index 5b30bb5..7d6a125 100644 --- a/classes/cache/holo_cache_redis.py +++ b/classes/cache/holo_cache_redis.py @@ -1,6 +1,6 @@ import logging from logging import Logger -from typing import Dict, Any, List +from typing import Dict, Any from redis import Redis @@ -25,9 +25,7 @@ class HoloCacheRedis(HoloCache): "Cache configuration is invalid. Please check if all keys are set (engine: memcached)" ) - uri_split: List[str] = engine_config["uri"].split(":") - - return cls(Redis(host=uri_split[0], port=int(uri_split[1]))) + return cls(Redis.from_url(engine_config["uri"])) def get_json(self, key: str) -> Any | None: try: diff --git a/config_example.json b/config_example.json index 4e0008a..146e50f 100644 --- a/config_example.json +++ b/config_example.json @@ -28,7 +28,7 @@ "uri": "127.0.0.1:11211" }, "redis": { - "uri": "127.0.0.1:6379" + "uri": "redis://127.0.0.1:6379/0" } }, "logging": { diff --git a/migrations/202502092252.py b/migrations/202502092252.py index 9e5603a..b7430d6 100644 --- a/migrations/202502092252.py +++ b/migrations/202502092252.py @@ -15,7 +15,7 @@ class Migration(BaseMigration): { "type": None, "memcached": {"uri": "127.0.0.1:11211"}, - "redis": {"uri": "127.0.0.1:6379"}, + "redis": {"uri": "redis://127.0.0.1:6379/0"}, }, *[], )