Re: Caching with EO

"Jerry W. Walker" <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
Hi, Gino,

I've worked on what sounds like a similar app recently where a user  
was in a location identified by postal code and needed to know the  
closest several offices of an institution. The institution's records  
contained latitude and longitude data, and the US post office  
provides a table mapping postal codes to latitude and longitude.

My approach was to read the entire set of institutional records  
during application initialization, typically 100 to 100K offices and  
build Java arrays, one for the latitude, one for the longitude and  
one for a record reference to get the identified office records.

The Java arrays are small and fast, even for a large number of  
offices. Given a customer's postal code, I would reference a table  
mapping postal code to lat/long location, I then applied a geometric  
mapping against each of the latitude/longitude pairs to identify the  
nearest offices.

All of the code and the cached arrays were contained in a single  
class file with methods for identifying the nearest n offices and all  
offices within x miles of the user. The methods would each return an  
NSArray of office record references which I would build into an  
EOQualifier for an EOFetchSpec.

The most useful EOQualifier for this purpose is InSetQualifier:  
"Where a IN (x, y, z)" which comes from code by Pierre Bernard that  
can be found at:  http://bernard-web.com/pierre .

This was a demonstration app for a client, so I didn't include a  
method to refresh the cache, since it doesn't change very often, but  
doing so would have been trivial.

I don't know that this is the design problem you're facing, but from  
your description, it sounded like a similar problem.

Regards,
Jerry

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 protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/jerrywwalker% 
> 40gmail.com
>
> This email sent to [email protected]


--
__ Jerry W. Walker,
    WebObjects Developer/Instructor for High Performance Industrial  
Strength Internet Enabled Systems

     [email protected]
     203 278-4085        office
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.