angular-localForage icon indicating copy to clipboard operation
angular-localForage copied to clipboard

Use getItem instead of iterate for small getItem array lookups

Open scotttrinh opened this issue 7 years ago • 2 comments

Currently, even if you're only getting a single kv pair, if that lookup is in an array, it will iterate the whole database.

We should look into just returning a $q.all with the lookup of the exactly keys instead of skipping, or if the keys lookup is cheap, find some heuristic to know when it's cheaper to use iterate vs. multiple getItem calls.

scotttrinh avatar Feb 22 '17 21:02 scotttrinh

I found LocalForage-getItems, but I dont know how use it with angular-localForage.

pablorsk avatar Apr 29 '17 03:04 pablorsk

Yeah, you'd have to set it up in a config block or something like that. I think there is a way to accomplish a similar thing as that extension, but I think we want to stick with vanilla localForage so we don't have to burden users with another dependency. Thanks for pointing that out, though! I'm sure there will be some useful things to learn from reading through that code.

scotttrinh avatar Apr 29 '17 13:04 scotttrinh