wcandillon / swagger-js-codegen

A Swagger Codegen for typescript, nodejs & angularjs
Apache License 2.0
693 stars 286 forks source link

[WIP] Fix cache policy and return with response #66

Closed hekike closed 8 years ago

hekike commented 9 years ago

Changes:

Why return with additional response params? Headers may contains necessary data like x-total-count (needed for pagination for example)

hekike commented 9 years ago

oops, I forgot the tests :) I'll fix. How do you like the concept?

wcandillon commented 9 years ago

@hekike I like it. I used to have a similar approach in the past and noticed the two following issues:

hekike commented 9 years ago

@wcandillon I think it's better if we invalidate it when we are sure that it's changed, instead of doing nothing. But yes, still should have expiration date for cache entries. Would you be open to use a 3rd party cache library for expiration? It's saddly not implemented in $cacheFactory.

I'm using your library for an admin and it's pretty strange when I save something and don't see the changes. But without caching it's too slow. Maybe should provide an option to controlling these kind of invalidations by method and expiration.

wcandillon commented 9 years ago

@hekike I used http://jmdobry.github.io/angular-cache/ but it still required a lot of manual work. Maybe http://angular-data.pseudobry.com/documentation/api/angular-cache/angular-cache is the solution but I haven't check it out.

hekike commented 9 years ago

@wcandillon thanks. I will investigate/implement it and update you here.

wcandillon commented 8 years ago

@hekike Feel free to reopen if necessary.