Re: EO Caching
Re: EO Caching
- Subject: Re: EO Caching
- From: Chuck Hill <email@hidden>
- Date: Mon, 10 Dec 2007 16:37:08 -0800
On Dec 10, 2007, at 3:58 PM, Paul Hertz wrote:
At 10:41 AM -0800 12/7/07, Chuck Hill wrote:
On Dec 7, 2007, at 7:01 AM, Jeffrey Simpson wrote:
I want to preload some EOs and so they are cached. I have set
ERXEC.setDefaultFetchTimestampLag(86400000);
That only applies to faulting, not fetching. You might want to
look at the much feared EOSharedEditingContext or at Wonder's EO
caching classes (there are three or so, IIRC). Also look at the
"Cache in memory" setting in EOModeler.
I preload my EOs and do some
batch fetching. Later on I use a fetch spec to query from the
database some
of the cached EOs. They are fully fetched which I understand is
the case.
When I then batch fetch these EOs the system always runs fetches.
It is not clear to me what code you are using here. I will note
that all fetches (ec.objectsWithFetchSpecification) go to the
database, even if the fetched data is then discarded. Batch
fetching is a fetch.
As I understand it (more foggy than I'd like), the record from the
database will be discarded if the global ID that gets generated for
the fetched row corresponds to an object in the editing context
that is not a fault.
Yes. Unless the fetch is marked as refreshing refetched objects, in
which case the object store and all editing contexts are updated.
In that case, the object from the editing context is returned. That
should save some computational time (yes?),
Yes, but can also lead to inconsistencies. The objects returned
match the criteria as determined by the database. If another process
has updated the database, you may have objects in memory that would
have matched the criteria but which are not included in the results
as the in-memory values differ from the database.
but clearly not as much as if one knows the object is already in
memory and uses it without calling objectsWithFetchSpecification.
Especially not the case if the WO server and the database server
are separate machines, and time is taken up by network communications.
That needs to also account for the time to evaluate the query against
the objects in memory vs letting the database do it and moving the
data around. It many situations, it ought to be faster.
I am, however, curious about what you are trying to fix. I have
never had to resort to this sort of thing.
Chuck
The time
between this fetch and the preloading is < 5 minutes. If I run
the same
query in a the same ec then the EOs are cached. Any idea of why
there is no
caching between the 2 ecs?
No, not without a clearer understanding of your code.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems.
http://www.global-village.net/products/practical_webobjects
--
Paul Hertz <email@hidden> |(*,+,#,=)(#,=,*,+)(=,#,
+,*)(+,*,=,#)|
<http://collaboratory.nunet.net/phertz>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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