goodeggs / angular-cached-resource

An AngularJS module to interact with RESTful resources, even when browser is offline
MIT License
216 stars 29 forks source link

Allow use of IndexedDB #17

Open hazeledmands opened 10 years ago

hazeledmands commented 10 years ago

Perhaps some feature detection decides whether to use IndexedDB (preferred) and then localStorage (fallback). Means that the cache needs to work asynchronously. (We're most of the way there already).

Why avoid localStorage?

For storing larger amounts of data, $localStorage should be avoided, since browsers will load the entire contents of an origin’s localStorage from disk each time the page is loaded. See: The Performance of localStorage Revisited

jtomaszewski commented 10 years ago

Maybe instead of using global window.localStorage, we should be able to configure the cache provider, or even maybe define our own $cacheFactory? For example, see option storageImpl in angular-cache plugin .

Or maybe even we could just use angular-cache plugin? It seems like being very optimised and well tested. On the other side, this would be an additional dependency to this project.