Is there any way to detect when a python program will end? Something like a callback I can connect to?
I have a class that saves cache , and I would like to write the cache to disk before the program terminates. If I can do this, I can load it from disk on first use and have a persistent cache.
I am looking for a type of callback type, although I want to automate it, so the user does not need to do anything to save the cache.
source share