<s> __author__ = """<STR_LIT>""" <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from os import getcwd <EOL> from os import sys <EOL> sys . path . append ( getcwd ( ) ) <EOL> from MOAL . helpers . display import Section <EOL> from MOAL . helpers . display import print_success <EOL> from MOAL . helpers . display import prnt <EOL> from MOAL . helpers . trials import run_trials <EOL> from MOAL . helpers . trials import test_speed <EOL> from faker import Factory <EOL> from redis import Redis <EOL> DEBUG = True if __name__ == '<STR_LIT:__main__>' else False <EOL> faker = Factory . create ( ) <EOL> redis_conn = Redis ( host = '<STR_LIT:localhost>' , port = <NUM_LIT> , db = <NUM_LIT:0> ) <EOL> pipe = redis_conn . pipeline ( ) <EOL> testing = { } <EOL> def insert_name ( * args , ** kwargs ) : <EOL> key = faker . name ( ) <EOL> val = faker . email ( ) <EOL> testing [ key ] = val <EOL> pipe . set ( key , val ) <EOL> pipe . get ( key ) <EOL> @ test_speed <EOL> def insert_all ( max_records ) : <EOL> for n in range ( max_records ) : <EOL> insert_name ( ) <EOL> if DEBUG : <EOL> with Section ( '<STR_LIT>' ) : <EOL> run_trials ( insert_all , trials = <NUM_LIT:10> ) <EOL> print_success ( '<STR_LIT>' ) <EOL> res = pipe . execute ( ) <EOL> prnt ( '<STR_LIT>' , res ) </s>
