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

Implemented dictionary functions #62

Closed
wants to merge 3 commits into from

Conversation

functionaldude
Copy link

I'm currently developing an app, where I use a separate cache for debug information. This cache only holds debug information, if the app crashes the contents of the cache is uploaded to a backend server for analysis. Currently there is no other way to iterate over the contents of the cache.

@aschuch
Copy link
Owner

aschuch commented Apr 9, 2016

Please take a look at my current draft of AwesomeCache 3.0 (#56), is the new allObjects what you are looking for?

@functionaldude
Copy link
Author

No, that doesn't work for me, because I need to upload the whole key-value pair. allObjects returns only the values. It is possible to use allObjects with a workaround, by generating a random key. Using that I could insert the original key and value as a tuple in the cache but as far as I know AwesomeCache doesn't support tuples as value.
The best solution would be a function that returns a snapshot of the cache as a NSDictionary.

@functionaldude functionaldude changed the title made function allKeys public Implemented dictionary functions Apr 10, 2016
@functionaldude
Copy link
Author

I implemented 3 dictionary functions. asDictionary() returns the whole cache content, dictionaryWithValuesForKeys returns either keys with nils where the object is not present anymore (keysForNullableObjects) or no keys at all for nil safe calls (keysForObjects).

You can get a collection of the values (as discussed in #59) by calling asDictionary().values.

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

Successfully merging this pull request may close these issues.

2 participants