#NEWLINE# def load_and_get_count( name , namespace = 'default' , period_type = 'all' , period = datetime . now ( ) ) : #NEWLINE# #INDENT# partial_key = LivecountCounter . PartialKeyName ( period_type , period , name ) #NEWLINE# count = memcache . get ( partial_key , namespace = namespace ) #NEWLINE# if ( count is None ) : #NEWLINE# #INDENT# full_key = LivecountCounter . KeyName ( namespace , period_type , period , partial_key ) #NEWLINE# record = LivecountCounter . get_by_key_name ( full_key ) #NEWLINE# if record : #NEWLINE# #INDENT# count = record . count #NEWLINE# memcache . add ( partial_key , count , namespace = namespace ) #NEWLINE# #UNINDENT# #UNINDENT# return count