Beispiel #1
0
def get_event_response_data_from_cache(event_id):
    """get the reposne of event from cache
    args:
        event_id: id of the event
    return:
        return the response data
    """
    from utils_helper import Util_Helpers
    key = Util_Helpers.cache_key_creation(["event", event_id, "response"])
    event_responses = redis.smembers(key)
    return event_responses
Beispiel #2
0
def cache_user_rsvp_response(response, event_id, previous_event=False):
    """
    1. Get the response dictionary.
    2. JSONIFY (serialize it so that it can be saved in redis cache)
    3. Insert the response into the list
    """
    # in case of previous_event we dont need to convert tag name
    # prvious event means if manually cache the response to run job
    if not previous_event:
        tag_ques_response = modify_reponse_of_user(response)
        response[tag_ques_response[0]] = tag_ques_response[1]
    # concate reponse
    for key, value in response.iteritems():
        if isinstance(value, list):
            response[key] = ','.join(value)
        else:
            response[key] = value
    from utils_helper import Util_Helpers
    key = Util_Helpers.cache_key_creation(["event", event_id, "response"])
    response = json.dumps(response)
    redis.sadd(key, response)