In my script I read messages from socket and change the state of some objects in memory depending on the content in message. Everything works fine.
But I want to implement deletion of non-active objects: for example, if there’s no message for specified object during some time, it should be deleted. What is the best way to do it ?
This one might not work for you, but:
if you’re okay with not removing objects after a specified time, but only keeping a specified number of objects, Python 3.2 has functools.lru_cache for exactly that.