(key: str)
return type(default)(value)
This method returns the value for the given :param key: from redis.
    Vaules of non-existing keys are set to their respective default value.
This method returns the value for the given :param key: from redis.
    Vaules of non-existing keys are set to their respective default value.
This method returns the value for the given : param key : from redis . Vaules of non - existing keys are set to their respective default value .
def get(key: str) -> Union[bool, int, float, str, List, Dict]:
    """This method returns the value for the given :param key: from redis.
    Vaules of non-existing keys are set to their respective default value."""
    # values are stored as string in redis
    # cast the value to its respective type, defined by the default value, before returning it
    default = defaults[key]
    value = redis_connection.get(key)
    if value is None:
        return default
    if type(default) == bool:
        # bool("False") does not return False -> special case for bool
        return value == "True"
    elif type(default) in (list, dict):
        # evaluate the stored literal
        return literal_eval(value)
    return type(default)(value)
def get ( key : str ) -> Union [ bool , int , float , str , List , Dict ] : # values are stored as string in redis # cast the value to its respective type, defined by the default value, before returning it default = defaults [ key ] value = redis_connection . get ( key ) if value is None : return default if type ( default ) == bool : # bool("False") does not return False -> special case for bool return value == "True" elif type ( default ) in ( list , dict ) : # evaluate the stored literal return literal_eval ( value ) return type ( default ) ( value )