AngularJS service that provides a generic way to cache promises and ensure all cached promises are resolved correctly