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

Performance issue when removeExpiredObjects #93

Open
namanhams opened this issue Oct 26, 2016 · 1 comment
Open

Performance issue when removeExpiredObjects #93

namanhams opened this issue Oct 26, 2016 · 1 comment

Comments

@namanhams
Copy link

When calling this method, it unarchived all objects in the cache, which causes serious performance issue in my situation.
So in my cache, i have 3 keys, each map to an array of 1000 objects. Now to check which key is expired, it needs to unarchived all 3000 objects, which is seriously slow, and it doesn't make sense.
1 solution for this, is we store the timestamp (NSDate) for each key. So N keys will have N timestamps. Then when we need to check which key is expired, we only need to unarchived N NSDate objects, instead of all the objects that they keys are mapped to, which could be N*M

So if we have 1000 keys maps to 1000 objects, then the performance is the same. But if we have 3 keys maps to 3000 objects, then you can see that the performance is way better.

In my app, i also store the timestamps for each key, but then i cannot retrieve the keys, because function allKeys() is private. So right now i'm stuck.

@cabarique
Copy link

Any updates on this issue?

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

2 participants