Cleaning "garbage" in Core Data

2009-08-16 Thread Squ Aire
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

Re: Cleaning "garbage" in Core Data

2009-08-16 Thread I. Savant
On Aug 16, 2009, at 8:00 AM, Squ Aire wrote: I have an Employee entity with the attribute userInfo, which is a binary data type that stores some NSDictionary of key-value pairs. Sounds reasonable. With time, as the user uses the app, "garbage" will pile up (albeit gradually) in these dic

Re: Cleaning "garbage" in Core Data

2009-08-16 Thread Jerry Krinock
On 2009 Aug 16, at 05:00, Squ Aire wrote: 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.

RE: Cleaning "garbage" in Core Data

2009-08-16 Thread Squ Aire
Thanks for the reply. Just to make it clear: The whole userInfo dictionary will tend to NOT be "garbage". Only a subset of key-value pairs within the userInfo dictionaries for the employees will be "garbage". I want to get rid of this subset without bothering the user in any way. Therefore, t

Re: Cleaning "garbage" in Core Data

2009-08-16 Thread Graham Cox
On 17/08/2009, at 1:22 AM, Squ Aire wrote: Just to make it clear: The whole userInfo dictionary will tend to NOT be "garbage". Only a subset of key-value pairs within the userInfo dictionaries for the employees will be "garbage". I want to get rid of this subset without bothering the user

Re: Cleaning "garbage" in Core Data

2009-08-16 Thread Sherm Pendley
On Sun, Aug 16, 2009 at 11:22 AM, Squ Aire wrote: > > Just to make it clear: The whole userInfo dictionary will tend to NOT be > "garbage". Only a subset of key-value pairs within the userInfo dictionaries > for the employees will be "garbage". I want to get rid of this subset without > botherin

RE: Cleaning "garbage" in Core Data

2009-08-16 Thread Squ Aire
For now, just imagine that a set of valid (non-garbage) keys are stored in a ValidKeys entity (with a single attribute called 'key' of type string). Or just imagine some global array storing those keys if you like that better. Now, imagine that we have chosen a bunch of employees to "clean up"

Re: Cleaning "garbage" in Core Data

2009-08-16 Thread I. Savant
On Aug 16, 2009, at 11:22 AM, Squ Aire wrote: Just to make it clear: The whole userInfo dictionary will tend to NOT be "garbage". Only a subset of key-value pairs within the userInfo dictionaries for the employees will be "garbage". I want to get rid of this subset without bothering the use

Re: Cleaning "garbage" in Core Data

2009-08-16 Thread I. Savant
On Aug 16, 2009, at 11:34 AM, Squ Aire wrote: For now, just imagine that a set of valid (non-garbage) keys are stored in a ValidKeys entity (with a single attribute called 'key' of type string). Or just imagine some global array storing those keys if you like that better. ... Surely it

RE: Cleaning "garbage" in Core Data

2009-08-16 Thread Squ Aire
> Seems to me that the source of the problem is the mixing of transient > and persistent key-value pairs within the same dictionary. If you > store the transient pairs in a dictionary of their own, that whole > dictionary could be transient. It's not like that. I don't decide beforehand what is

Re: Cleaning "garbage" in Core Data

2009-08-16 Thread I. Savant
On Aug 16, 2009, at 11:47 AM, Squ Aire wrote: So, just imagine that I am dealing with this situation, have this garbage and need to clean it up :) [ FACE-PALM ] Unspecific question? Unspecific answer: Memory Management Using Core Data http://developer.apple.com/documentation/Cocoa/Conce

Re: Cleaning "garbage" in Core Data

2009-08-16 Thread Graham Cox
On 17/08/2009, at 1:47 AM, Squ Aire wrote: Key-value pairs in the userInfo dictionaries are "marked as garbage" as the app is running and depending on various factors. Don't "mark as garbage" - delete them. Problem solved. If you need them to stick around in the garbage state, they're not

RE: Cleaning "garbage" in Core Data

2009-08-16 Thread Squ Aire
> Don't "mark as garbage" - delete them. Problem solved. If you need > them to stick around in the garbage state, they're not garbage! I am not *explicitly* marking anything as garbage. Whenever a user decides to remove a ValidKeys managed object, corresponding key-value pairs in all the user

Re: Cleaning "garbage" in Core Data

2009-08-16 Thread Caleb Strockbine
On Aug 16, 2009, at 3:02 PM, Graham Cox wrote: On 17/08/2009, at 1:47 AM, Squ Aire wrote: Key-value pairs in the userInfo dictionaries are "marked as garbage" as the app is running and depending on various factors. Don't "mark as garbage" - delete them. Problem solved. If you need them to s

Re: Cleaning "garbage" in Core Data

2009-08-16 Thread BJ Homer
On Sun, Aug 16, 2009 at 10:35 AM, Squ Aire wrote: > > I am not *explicitly* marking anything as garbage. Whenever a user decides > to remove a ValidKeys managed object, corresponding key-value pairs in all > the userInfo dictionaries are *conceptually* marked as garbage. This is > because I do no

Re: Cleaning "garbage" in Core Data

2009-08-16 Thread Jerry Krinock
To Squ: I read through all your posts today and, although several people have asked you, I still don't see where you've confirmed that this garbage/ cleanup is indeed a performance issue. My recommendation remains that you confirm this first, especially now that multithreading Core Data h

RE: Cleaning "garbage" in Core Data

2009-08-17 Thread Ben Trumbull
Squ, You're basically saying you don't want to model your data formally, but you do want to write your own relationship maintenance and delete propagation system. That is a lot of work. At this point, your problem doesn't have anything to do with Core Data. You have NSDictionaries wit