from threading import Timer import random #Objective: receive specific information, and store. #Set a timer and once it has passed empty the storing structure #and renew the timer and proceed to continue storing def bleh(): print "\nEmpyting Event Id Hash\n" global hash hash = {} t1 = Timer(3, bleh).start() t.cancel() if __name__ == '__main__': hash = {} t = Timer(1, bleh) t.start() eventidlist = [1,1,2,3,4,3,2,3,4,5,3,3,6,7,8,6,5,6,88,9,7,6] while True: #Simulating "data streaming" for num in eventidlist: if num not in hash: hash[num] = 1 print "process Event", num