• 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: caching
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: caching


  • Subject: Re: caching
  • From: Sacha Mallais <email@hidden>
  • Date: Wed, 11 May 2005 11:18:23 -0700

On May 11, 2005, at 10:58 am, Mike Schrag wrote:

So the problem is that these are top level objects, so there's no relationship I can traverse to get to them, which means that while the row itself may come from the snapshot, a query is still executed to retrieve the ID. And on any given page, I have to resolve as many as 40 of these by their Name field (for several technical reasons, the EO's have to be looked up by name and can't exist as relationships from the container EO). So every page kicking off 40 queries, regardless of whether they pull the data or not, is pretty painful.

If you are accessing them by the FK (which it appears that you're not, from what you said below), then you can get a fault from a global id (that you would construct).

Since it appears that you're bypassing EOF completely here, you could create your own cache in, for example, the session, and fault the objects into the needed EC instead of fetching them every time. But I'm assuming that this data is "lookup" data. If you have 40 unique eos attached to an entity without a relationship then you could create an ivar in the entity class to hold them.


sacha


On May 11, 2005, at 1:37 PM, Sacha Mallais wrote:

On May 11, 2005, at 10:22 am, Mike Schrag wrote:


So I have a case where one of my EO's has a unique key which can't be the primary key (it's changeable), but it is effectively the primary key (that is, the EO is almost always looked up by that key). I end up very frequently doing a qualifier on that field. What is the recommended way to avoid hitting the database constantly for these things? I would love to turn on Cache in Memory, but we saw where that led me on the last situation (Incidentally, i tried it again on this EO and it fails in the same way, which is to say, it does nothing :) ). So what I really want here is a most-recently-used cache mapped by the unique key. However, properly implementing this without stepping on EOF's toes appears that it might be really tricky (these EO's get updated and are referenced by and from other EO's). Any suggestions or anyone run into a similar problem?


Sounds like you should just be using the standard EOF caching. EOF keeps a copy of your object's data in a cache called the snapshot. If you _fetch_ data (via an EOFetchSpecification), EOF will go to the database, but if you fire a fault (by traversing a relationship, for example), EOF will only go to the database if the data does not already exist in the snapshot.

HTH,


sacha


-- Sacha Michel Mallais - 400 lb. chimp Global Village Consulting Inc.: http://www.global-village.net/ Choke on that, causality! -- the Professor, "Futurama"



--
Sacha Michel Mallais - 800 lb. gorilla
Global Village Consulting Inc.:   http://www.global-village.net/
Bottom posting is your friend:
http://www.river.com/users/share/etiquette/

_______________________________________________
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: 
 >caching (From: Mike Schrag <email@hidden>)
 >Re: caching (From: Sacha Mallais <email@hidden>)
 >Re: caching (From: Mike Schrag <email@hidden>)

  • Prev by Date: Re: caching
  • Next by Date: Re: Weird Logging with my 5.2.4 deployment
  • Previous by thread: Re: caching
  • Next by thread: Re: caching
  • Index(es):
    • Date
    • Thread