#NEWLINE# def get_many( self , fields , database_fallback = True ) : #NEWLINE# #INDENT# results = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# def _get_many( redis , fields ) : #NEWLINE# #INDENT# for field in fields : #NEWLINE# #INDENT# key = self . get_key ( field ) #NEWLINE# logger . debug ( 'getting field %s from %s' , field , key ) #NEWLINE# result = redis . hget ( key , field ) #NEWLINE# results [ field ] = result #NEWLINE# #UNINDENT# return results #NEWLINE# #UNINDENT# results = self . _pipeline_if_needed ( _get_many , fields ) #NEWLINE# results = dict ( zip ( fields , results ) ) #NEWLINE# if database_fallback : #NEWLINE# #INDENT# missing_keys = [ f for f in fields if ( not results [ f ] ) ] #NEWLINE# database_results = self . get_many_from_fallback ( missing_keys ) #NEWLINE# results . update ( database_results ) #NEWLINE# self . set_many ( database_results . items ( ) ) #NEWLINE# #UNINDENT# return results