Python - playing around with caching and python socket libraries