Re: Business Entity Hierarchy OO question
- From: "PS" <ecneserpegats@xxxxxxxxxxx>
- Date: Thu, 15 Mar 2007 00:38:16 -0400
"Bruce Wood" <brucewood@xxxxxxxxxx> wrote in message
news:1173855556.202480.255000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I agree with PS, except that I wouldn't call it a "Registry". It's
called cache.
I misused the terms a little. I meant an object that would talk to the cache
and if the cache doesn't have the object then would talk to the builder.
This way you have one "point of entry" to get an object.
Basically, you load an object into memory only when some code asks for
it. Unfortunately, as is usual in computing, there are competing
considerations:
1) You don't want to load large tables into memory at start up just in
case you'll need them.
2) You don't want to make thousands of calls to the database to
retrieve single rows when you can make fewer calls to return groups of
rows.
3) The more you cache, the less you have to go to the database (over
time).
4) The more you cache, the more stale your data becomes, and the more
likely that the database will change "beneath" your cache, making
updates / writes that your user does conflict with the data in the
database.
For some tables it will be a no-brainer. If they're small and rarely
change, just load them at start-up, cache them, and grab objects as
they're needed.
For other tables it will be problematic: large tables that shouldn't
be read all at once, or tables that change frequently and so shouldn't
be cached for long periods.
Unfortunately there's no one-size-fits-all answer here. One of my apps
loads most of the tables upon first reference (because they're small,
< 1000 rows, and rarely change), but loads others piecemeal because
loading them at startup would cause an unacceptable delay.
Nice reply Bruce.
.
- References:
- Business Entity Hierarchy OO question
- From: Narshe
- Re: Business Entity Hierarchy OO question
- From: PS
- Re: Business Entity Hierarchy OO question
- From: Bruce Wood
- Business Entity Hierarchy OO question
- Prev by Date: Re: Time zone
- Next by Date: Re: Trolling
- Previous by thread: Re: Business Entity Hierarchy OO question
- Next by thread: Re: Business Entity Hierarchy OO question
- Index(es):
Relevant Pages
|