<s> def get_namedomainuuid_by_id ( db , client , userid ) : <EOL> namedomain = client . hmget ( '<STR_LIT>' + userid , [ '<STR_LIT:name>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> if namedomain [ <NUM_LIT:0> ] and namedomain [ <NUM_LIT:1> ] and namedomain [ <NUM_LIT:2> ] : <EOL> return namedomain <EOL> else : <EOL> userinfo = db . get ( "<STR_LIT>" , userid ) <EOL> client . hmset ( '<STR_LIT>' + userid , { "<STR_LIT:name>" : userinfo . name , "<STR_LIT>" : userinfo . domain , "<STR_LIT>" : userinfo . uuid_ } ) <EOL> return [ userinfo . name , userinfo . domain , userinfo . uuid_ ] <EOL> def get_domain_by_name ( db , client , username ) : <EOL> username = username . lower ( ) <EOL> domain = client . hmget ( "<STR_LIT>" % username , [ "<STR_LIT>" , ] ) <EOL> if domain [ <NUM_LIT:0> ] : <EOL> return domain [ <NUM_LIT:0> ] <EOL> else : <EOL> domainid = db . get ( "<STR_LIT>" , username ) <EOL> if domainid : <EOL> client . hmset ( "<STR_LIT>" % username , { "<STR_LIT>" : domainid . domain , "<STR_LIT:id>" : domainid . id } ) <EOL> return domainid . domain <EOL> return None <EOL> def get_id_by_name ( db , client , username ) : <EOL> username = username . lower ( ) <EOL> user_id = client . hmget ( "<STR_LIT>" % username , [ "<STR_LIT:id>" , ] ) <EOL> if user_id [ <NUM_LIT:0> ] : <EOL> return user_id [ <NUM_LIT:0> ] <EOL> else : <EOL> domainid = db . get ( "<STR_LIT>" , username ) <EOL> if domainid : <EOL> client . hmset ( "<STR_LIT>" % username , { "<STR_LIT>" : domainid . domain , "<STR_LIT:id>" : domainid . id } ) <EOL> return domainid . id <EOL> return None </s>
