• 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: Question on fetching theory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on fetching theory


  • Subject: Re: Question on fetching theory
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 21 May 2009 15:16:32 -0700


On May 21, 2009, at 2:32 PM, Dan Grec wrote:


On 21-May-09, at 12:00 PM, Chuck Hill wrote:


On May 21, 2009, at 12:57 AM, Gustavo Adolfo Pizano wrote:

Aha, so, if I use the Cache in memory property in the EO, the framework will not fetch all the time, unless I tell the EO to flushCacheProcessor, and do the fetch again?.. I read the documentation about this method after have read and thought in implementing a Proxy Cache.. which I implemented long time ago at school but now its kinda confusing.

Or is there another "tricky" thing hidden form me in this aspect when setting cache in memory property on a EO.

I'd be careful about using Cache in Memory on an EO. That is really intended for lookup objects. I'd look at a has map / dictionary in the component instead

Hey Chuck, a question about your above answer; Is it OK to cache EO's in HashMaps or similar on Components?

Yes, but...


We have one EO in particular that is created/deleted quite frequently and we find that every time we cache it we run into trouble with it going null, or getting null when we enumerate over a relationship to the EO, or any number of other annoying, exception invoking things.

...I would not cache something like that, or would handle it very carefully if I did. I'd cache the that is related to these and traverse its relationship.



Lately we've been trying to avoid holding references to EO's on our components and are of course having performance issues - are we being paranoid?

Yep. :-)


I feel like holding a strong reference to an EO is just using a big stick to interfere with how an EditingContext works.

Unless you have configure it to do so, the EC does NOT hold a strong reference to the EOs in it. So if you don't have a reference somewhere (direct or indirect), they will get garbage collected.


See ERXEOEntityCache in Wonder. It tries to do too much to make it easy to understand, but it does work (in various ways).


Chuck



On May 20, 2009, at 9:24 PM, Chuck Hill wrote:


On May 20, 2009, at 12:21 PM, Gustavo Adolfo Pizano wrote:

Aha, so I will need to manage a way to know if that particular item was selected already, if so then I wouldn't have to fetch again but return what is in memory already? then if I want fresh data, I will need to provide a way to make the fetches again, am I right?

That sounds about right.


On May 20, 2009, at 7:55 PM, Chuck Hill wrote:

Fetches always go back to the server. Faults will use the cached data. You are going to need to do some caching to avoid repeated fetches.


Chuck


On May 20, 2009, at 10:23 AM, Gustavo Adolfo Pizano wrote:

Hello.

I think I have done something wrong.
As far as I know, and because the docs says so, I receive cached data unless 3 conditions.
•
the timestamp of the snapshots of enterprise objects are older than the editing context’s timestamp


	•
the enterprise object has been invalidated

•
the enterprise object is a fault (its data hasn’t yet been fetched



In my application, I have a ERXEC, in which I did the following.


EOModel model = EOModelGroup.defaultGroup().modelNamed("LDAPModel");
NSMutableDictionary<String, String> overrides = new NSMutableDictionary<String, String>();
overrides.takeValueForKey("ldap://localhost:389/ cn=Contacts,o=xws", "serverUrl");
EODatabaseContext.forceConnectionWithModel(model, overrides,abEC);
groups = XWSContactsGroup.fetchAllXWSContactsGroups(abEC,
new NSArray(new Object[] {ERXSortOrdering.sortOrderingWithKey(XWSContactsGroup.CN, ERXSortOrdering.CompareAscending)}));


I change the connection dictionary of the model for 2 reasons, was the only documented way I found to do that in order to change the BASE search on LDAP(old question I post on the list). And second, so only that EC will have access to that level in the LDAP.

Anyway, as you know Im working with a AjaxSelectionList, which is working (so far), so when I select some item, its the action binding is firing a method in which Im fetching the data for that particular item. Im doing the following.

NSArrray = contactLsits = XWSContact .fetchAllXWSContacts(abEC,XWSContact.PARENT.eq(selectedItem.cn),
new NSArray(new Object[] {ERXSortOrdering.sortOrderingWithKey(XWSContacts.CN, ERXSortOrdering.CompareAscending)}));


So I getting the array of contacts for the given group. ALL FINE, perfect. if I select another group form the list, then again I get a list of contacts for that new group, BUT, if I select the previous group in the list, I see in the LDAP console that I made a fetch again.

I thought I would get it from the EC without making a fetch, this behavior, make same think, that if somebody start just clicking between group items in the list, it will keep making fetchs to the server, isn't this dangerous? I mean in big proportions?

Thanks in advance.

Gustavo

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

This email sent to email@hidden

-- Chuck Hill Senior Consultant / VP Development

Come to WOWODC'09 in San Fran this June!
http://www.wocommunity.org/wowodc09/




-- Chuck Hill Senior Consultant / VP Development

Come to WOWODC'09 in San Fran this June!
http://www.wocommunity.org/wowodc09/




-- Chuck Hill Senior Consultant / VP Development

Come to WOWODC'09 in San Fran this June!
http://www.wocommunity.org/wowodc09/

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


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


-- Chuck Hill Senior Consultant / VP Development

Come to WOWODC'09 in San Fran this June!
http://www.wocommunity.org/wowodc09/

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


References: 
 >Question on fetching theory (From: Gustavo Adolfo Pizano <email@hidden>)
 >Re: Question on fetching theory (From: Chuck Hill <email@hidden>)
 >Re: Question on fetching theory (From: Gustavo Adolfo Pizano <email@hidden>)
 >Re: Question on fetching theory (From: Chuck Hill <email@hidden>)
 >Re: Question on fetching theory (From: Gustavo Adolfo Pizano <email@hidden>)
 >Re: Question on fetching theory (From: Chuck Hill <email@hidden>)
 >Re: Question on fetching theory (From: Dan Grec <email@hidden>)

  • Prev by Date: Re: ERXEC.useSharedEditingContext
  • Next by Date: Re: lock operation locked more than one row issue!
  • Previous by thread: Re: Question on fetching theory
  • Next by thread: JavaFSAdaptor and non-working EO methods
  • Index(es):
    • Date
    • Thread