seperated caching code to a different file