File size: 382 Bytes
ebebee8
 
 
 
5d958f6
 
ebebee8
 
 
5d958f6
 
b2df416
5d958f6
b2df416
5d958f6
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)