Spaces:
Runtime error
Runtime error
File size: 542 Bytes
2756582 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import os
from functools import lru_cache
from pydantic_redis import RedisConfig
from redis import Redis
host = os.environ.get("REDIS_HOST", "localhost")
port = int(os.environ.get("REDIS_PORT", 6379))
password = os.environ.get("REDIS_PASSWORD", None)
ssl = True if os.environ.get("REDIS_SSL") else False
@lru_cache(maxsize=1)
def get_redis_client():
return Redis(host=host, port=port, password=password, ssl=ssl)
@lru_cache(maxsize=1)
def get_redis_config():
return RedisConfig(host=host, port=port, password=password, ssl=ssl)
|