$http cache returning a promise

First stab at adding support for cache factories that return promises. The motivation for this was adding support for using IndexedDB as a backend of the cache factory when most operations on it are asynchronous and must therefore return promises.

I'm not completely happy with the duplication of code in the callback. Also, the mocking of the cache factory may not be the best practice. Feedback appreciated ).