move caching to its own module