Changed default URI for Redis

This commit is contained in:
2025-02-09 23:40:09 +01:00
parent a54ef39e53
commit cda570eb37
3 changed files with 4 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
import logging import logging
from logging import Logger from logging import Logger
from typing import Dict, Any, List from typing import Dict, Any
from redis import Redis from redis import Redis
@@ -25,9 +25,7 @@ class HoloCacheRedis(HoloCache):
"Cache configuration is invalid. Please check if all keys are set (engine: memcached)" "Cache configuration is invalid. Please check if all keys are set (engine: memcached)"
) )
uri_split: List[str] = engine_config["uri"].split(":") return cls(Redis.from_url(engine_config["uri"]))
return cls(Redis(host=uri_split[0], port=int(uri_split[1])))
def get_json(self, key: str) -> Any | None: def get_json(self, key: str) -> Any | None:
try: try:

View File

@@ -28,7 +28,7 @@
"uri": "127.0.0.1:11211" "uri": "127.0.0.1:11211"
}, },
"redis": { "redis": {
"uri": "127.0.0.1:6379" "uri": "redis://127.0.0.1:6379/0"
} }
}, },
"logging": { "logging": {

View File

@@ -15,7 +15,7 @@ class Migration(BaseMigration):
{ {
"type": None, "type": None,
"memcached": {"uri": "127.0.0.1:11211"}, "memcached": {"uri": "127.0.0.1:11211"},
"redis": {"uri": "127.0.0.1:6379"}, "redis": {"uri": "redis://127.0.0.1:6379/0"},
}, },
*[], *[],
) )