Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use getItem instead of iterate for small getItem array lookups #134

Open
scotttrinh opened this issue Feb 22, 2017 · 2 comments
Open

Use getItem instead of iterate for small getItem array lookups #134

scotttrinh opened this issue Feb 22, 2017 · 2 comments
Assignees

Comments

@scotttrinh
Copy link
Owner

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 scotttrinh self-assigned this Feb 22, 2017
@pablorsk
Copy link

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

@scotttrinh
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants