I have an Employee entity with the attribute userInfo, which is a binary data 
type that stores some NSDictionary of key-value pairs.

With time, as the user uses the app, "garbage" will pile up (albeit gradually) 
in these dictionaries that are associated with the employees. And by "garbage", 
I mean key-value pairs that are not needed any more.

I really don't want to clean the garbage "on the go/before persisting" because 
I don't want to let the user wait unnecessarily. The purpose of this garbage 
buildup is the benefit of more responsive app, at the cost of little more 
temporary storage. I need your advice on how to actually make it temporary.

How would you clean up this garbage in such a way the user will not notice it? 
I have thought of two ways. Which would work? Which are impossible? Which is 
better? Do you recommend any others?


1.
When the app is idle, keep selecting random employees to clean up key-value 
pairs within them. Stop this process as soon as the app is not idle any more. 
Over time, this will tend to keep the app "clean", and the user won't notice 
anything. How could I do this? How can I figure out whether an app is idle? 
Will Apple's "Treading Programming Guide" help me with it?

2.
Judging from ONLY (yes, ONLY; do NOT break the NDA) the information already 
available on apple.com's GCD intro page and the nice PDF intro brochure they 
made for everyone, would I be able to create threads for this task, create MOCs 
for each of them, do the cleaning on those threads, and hand those threads to 
GCD? It sounds fancy and cool, but is this even a realistic solution? The 
problem I can think of is that when actually saving the "main MOC", the main 
MOC will still contain the garbage and wouldn't be able to figure out whether 
to persist the garbage or not.


Finally, note that I cannot use willTurnIntoFault, and clean up the garbage 
there, because it is very inefficient in my case to do the clean up for the 
managed objects one by one. And again, the user would have to wait while 
saving, which is a bad solution. I really have to do them in batches, in such a 
way that the user will not notice it.



--.
_________________________________________________________________
With Windows Live, you can organize, edit, and share your photos.
http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to