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

Re: Caching with EO


  • Subject: Re: Caching with EO
  • From: Mike Schrag <email@hidden>
  • Date: Thu, 4 Jan 2007 11:47:08 -0500

Also, as explained in http://en.wikibooks.org/wiki/ Programming:WebObjects/EOF/Using_EOF/Caching_and_Freshness#EOEntity. 27s_Cache-In-Memory_Setting , be careful with Cache in Memory. The runtime characteristics of it can be a little surprising. Most importantly, if you make ANY change to a Cache in Memory object, the entire cache will be flushed and reloaded on the next fetch. Note my extensive use of capitalized words in that wiki entry -- it's almost as if I've been burned by Cache in Memory before :)

ms

On Jan 4, 2007, at 10:34 AM, Ken Anderson wrote:

Gino,

There are a couple of factors I think need to be looked at before any particular decision is made:

1) Does that data change? My guess is no, but just checking
2) How much data is attached to each lat/long? Do you need all of it?


If, as I suspect, the data doesn't change, I would probably create a read-only EO with JUST the properties you need and fetch them (unless it's already that way), using a special or shared editing context. If your relationship to them is on a primary key, you can just create a fault and EOF will handle most of the plumbing. If your lookup is not by primary key, I suggest having a class method that has knowledge of the EC where the data is, and has built a dictionary with a hash key using the data you need to lookup by. Then you can just ask that class method for the right EO based on your parameters.

When I have a situation like this, I often put methods like this (not tested) on my cached/looked up EOs:

public static String hashKeyFor(BigDecimal latitude, BigDecimal longitude) {
return latitude+"|"+longitude; // probably should format the numbers in a standard way
}


public String hashKey() {
	return hashKeyFor(this.latitude(), this.longitude());
}

The class method is used to construct the hash key, and the instance method uses the static method to create a hash key for each instance of the EO.

Good luck!
Ken



On Jan 4, 2007, at 10:01 AM, Gino Pacitti wrote:

Hi All

Can anybody offer a little help as to a strategy for record access.

I have a table with 28000 records which hold lon lat information to which I have to query during a repetition.

For each record in a repetition I need to access a different table and pull lon lat for each postcode - this could be up to 100 simultaneous requests by individual users.

Is it best to set the entity to Cache in Memory and collect objects or is it better to collect raw rows?

Any help and advise would be appreciated..

Gino


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


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:
40mdimension.com


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


References: 
 >Caching with EO (From: Gino Pacitti <email@hidden>)
 >Re: Caching with EO (From: Ken Anderson <email@hidden>)

  • Prev by Date: Re: Caching with EO
  • Next by Date: Re: Caching with EO
  • Previous by thread: Re: Caching with EO
  • Next by thread: Re: Caching with EO
  • Index(es):
    • Date
    • Thread