Re: Caching with EO
Re: Caching with EO
- Subject: Re: Caching with EO
- From: Ken Anderson <email@hidden>
- Date: Thu, 04 Jan 2007 10:34:51 -0500
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:
This email sent to email@hidden