Improved caching API and switched to promises