Spaces:
Sleeping
Sleeping
| import json | |
| import os | |
| import redis | |
| import yaml | |
| from utils import yaml_path | |
| def redis_send(redis_conn,user_id, chat_id, answer): | |
| with open(yaml_path, 'r') as file: | |
| parameters_obj = yaml.safe_load(file) | |
| REDIS_TTL = parameters_obj.get("REDIS_TTL", 7200) | |
| return redis_conn.set(f"ANSWER_FOR_USER_ID{user_id}_OF_{chat_id}", json.dumps(answer), ex=REDIS_TTL) | |