2 Cache or ! 2 Cache?

Posts   
 
    
MarcoP avatar
MarcoP
User
Posts: 270
Joined: 29-Sep-2004
# Posted on: 03-Oct-2004 22:32:39   

I have a handfull of TypedList's that I use to fill some dropdown controls on my screens. Do you guys think it's worth caching these lists to minimize db calls? If so, I'll probably use the MS Caching App block for my caching infrastructure. Also, what layer do you think would be best to place the caching code?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39615
Joined: 17-Aug-2003
# Posted on: 04-Oct-2004 10:34:31   

It's always best to cache as high in the n-tier stack as possible. So if your application is a webapplication, and you have a set of webcontrols, cache these, not the data required to build the controls, as with caching the controls, you save yourself the time re-creating them all the time as well.

Frans Bouma | Lead developer LLBLGen Pro
omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 15-Oct-2004 20:36:43   

Greetings Otis,

Thats great for Web apps but what about WinForm applications. I use a mutli-column combo-boxes to display lookups for things like (AccountsList, EmployeesList, ...etc.)

Is it viable to cache the actual lists or you would suggest another way to do it...

OMAR disappointed

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39615
Joined: 17-Aug-2003
# Posted on: 15-Oct-2004 20:45:47   

If lists of data don't change, you can always load them into an entitycollection and store them in a hashtable in your application (one entry per collection). With caching however people tend to forget that caching only works with non-changing data, as changing data causes stale data in a cache, and it is hard to figure out when a cached data element is really out of sync with the database value or that it isn't stale enough..

Frans Bouma | Lead developer LLBLGen Pro