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

Question - Iterating? #51

Closed
ppearson111 opened this issue Sep 16, 2016 · 2 comments
Closed

Question - Iterating? #51

ppearson111 opened this issue Sep 16, 2016 · 2 comments

Comments

@ppearson111
Copy link

Just starting using Cache and it's worked great so far but I'm wondering if there's a way to iterate the cache of objects? The specific case I have is I initially store my objects with a numeric ID (converted to String) as the key... later I wish to lookup/find an object, but I have a "name" rather than the ID, so I'd like to iterate the cached objects, checking the name property to find a match. Terribly inefficient but that's the nature of the beast at this point. As I type this I realize if there were a way to have multiple keys that referenced the same cache object, that could be a solution to this issue as well - and faster for lookup. Thoughts? Thanks!

@vadymmarkov
Copy link
Contributor

@ppearson111 Hi there, don't really see any good ways to iterate the cached objects. Cache is not a replacement of database, and even though files live in the folder, without the key it's not that easy to search/filter. I would recommend to store objects with any unique ID that you know at the moment of lookup. Could you use a "name" initially instead of numeric ID? Another option could be to cache objects as a JSON array, but it highly depends on the context.

@zenangst
Copy link
Contributor

Closing because of lacking activity.

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

No branches or pull requests

3 participants