#NEWLINE# def _get_db_details( server , db ) : #NEWLINE# #INDENT# conn = server . connection #NEWLINE# conn . execute_command ( 'SELECT' , db ) #NEWLINE# size = conn . dbsize ( ) #NEWLINE# key_details = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( size > server . sampling_threshold ) : #NEWLINE# #INDENT# sampling = True #NEWLINE# pipe = conn . pipeline ( ) #NEWLINE# for _ in ( range if PY3 else xrange ) ( server . sampling_size ) : #NEWLINE# #INDENT# pipe . randomkey ( ) #NEWLINE# #UNINDENT# for key in set ( pipe . execute ( ) ) : #NEWLINE# #INDENT# key_details [ key ] = _get_key_info ( conn , key ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# sampling = False #NEWLINE# for key in conn . keys ( ) : #NEWLINE# #INDENT# key_details [ key ] = _get_key_info ( conn , key ) #NEWLINE# #UNINDENT# #UNINDENT# return dict ( keys = key_details , sampling = sampling )