One module is imported only once per process in Python (the modules are cached in sys.modules). If you see that atexit.register is called 5 times it means that you have 5 processes running. In that case flush is called 5 time, one time per process, and that is correct. BTW, I think the good practice is to call flush explicitly. I added the atexit trick to be defensive against sloppy programmers.
If you call flush multiple times nothing bad happens: the second time the cache of objects is empty and nothing is stored.
Of course this class is intended to be used in single threaded situations.