split caching into its own library