jmdobry / angular-cache

angular-cache is a very useful replacement for the Angular 1 $cacheFactory.
http://jmdobry.github.io/angular-cache
MIT License
1.39k stars 156 forks source link

cache.put add promise support #87

Closed bolasblack closed 10 years ago

bolasblack commented 10 years ago

Then i can use angular-cache with $http.

jmdobry commented 10 years ago

What is your use case with angular-cache and $http that is not doable due to the lack of promise support?

bolasblack commented 10 years ago

I hope i can use angular-cache with $http cache option.

jmdobry commented 10 years ago

@bolasblack You already can. Angular-cache fully supports the $cacheFactory API. You can use $angularCacheFactory in any place where you can use $cacheFactory.

Though as far as I can tell, this pull request enables the following:

$angularCacheFactory
    .get('someCache')
    .put($http.get('/post/5'))
    .then(function (post) {...})
    .catch(function (err) {...});

Correct?

jmdobry commented 10 years ago

When the tests run they are run once for each of the last 15 versions of Angular. Can you refactor your tests to not use finally? That's a recent feature, causing tests run against older versions of Angular to fail. See here.

bolasblack commented 10 years ago

@jmdobry I know what i need now! I'm trying to make storageMode can support promise.

bolasblack commented 10 years ago

@jmdobry oh, I found i made a mistake, I think angular will storage a promise into cache...

jmdobry commented 10 years ago

@bolasblack Okay!