• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: When exactly does a fault get fired?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When exactly does a fault get fired?


  • Subject: Re: When exactly does a fault get fired?
  • From: Andre <email@hidden>
  • Date: Fri, 17 Feb 2006 02:14:19 -0800

Aurélien Hugelé wrote:

Thanks, Aurélien for such a quick reply.

it is the willAccessValueForKey that fire the fault. Default NSManagedObject -valueForKey: implementation does call willAccessValueForKey: for you.
Thats what I was thinking.

Just one warning, i do not know what your needs are, but core data already accesses a sort of cache when your access an attribute. Having another cache above it is memory over use(because of your cache, the core data cache for this attribute may not be released), and maybe even dangerous (both cache needs to be synchronized, it can be complex).
I'm pretty sure that you want to use your own cache because you have problems with fault firing performances/core data performances, i had a lot of problems too. It may be interesting you explain *why* would you want to use your own cache mechanism.
Here's my reason. I'm working on a way to have a specific entity, that is accessed by a key that names it. So, the entity actually may contain a binary data or a large blob of text. Since I choose the object I want based on its "name" set a runtime (not the entity name), I want to scan through the set of items and get the one with the name I want, without tripping up the fault, as this can be very slow if there were a lot of objects to go over... imagine going through a list of 40+ objects, and some may have large RAW images attached, then coredata needs to fetch each one out of the persistent store just to find its name...... seems pretty inefficient.

I say it again, i do not know your needs, and you may have good reasons! :)
I hope my reason is good enough! What do you think?

If an object has been faulted, then does that mean its caches also have been cleared?
In this case, the objects I am pulling out have no cache..... hmm, it maybe gets tricky when I actually do un-fault the object, maybe in that case I turn off and clear my cache..... then when re-faulting, turn on and set my cache. Sound good?


Thanks for your help BTW.

Andre

Aurelien	


On 17 févr. 06, at 09:51, email@hidden wrote:

Hi, list, I've got a question concerning faults in core data.
If an entity has a attribute that is in the data model and has an accessor for it, when a call to the accessor occurs, does the fault fire exactly when the call [object valueForKey:@"Key"] gets sent, or, in the custom method, does the fault stay un-fired until I call [self willAccessValueForKey:@"Key"] or [self primitiveValueForKey:@""]....


I'm asking because I would like to cache a value without doing a separate accessor, so I'm wondering if I can return the cache if it exists instead...without fire a fault (thats the reason why I want to use a cache)....


Thanks in advance!

Andre
email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gumitech.com


This email sent to email@hidden



Andre email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: When exactly does a fault get fired?
      • From: Chris Hanson <email@hidden>
References: 
 >When exactly does a fault get fired? (From: email@hidden)
 >Re: When exactly does a fault get fired? (From: Aurélien Hugelé <email@hidden>)

  • Prev by Date: Re: When exactly does a fault get fired?
  • Next by Date: Re: Modifying Info.plist at runtime
  • Previous by thread: Re: When exactly does a fault get fired?
  • Next by thread: Re: When exactly does a fault get fired?
  • Index(es):
    • Date
    • Thread