Where to put cache logic?

Soldato
Joined
5 Mar 2003
Posts
10,771
Location
Nottingham
Hi,
I have a multi-tier application (UI, buslogic and data access). Now the application will be used by lots of people and hitting some fairly large databases to get small amounts of data, so I want to cache the results on the client machine; the only question is where. Ok well the UI is a no brainer - it doesnt belong there... so in the business logic layer or the dalc? Now I'm thinking it probably belongs in the dalc but I have always thought the dalc should be returning results from the DB and nothing else.

Can someone confirm? :)
Cheers.
 
Data access layer, in that the busniess logic will query the DA layer to get data. It doesnt care where the data is from, as long as the DA layer fulfills its contract - namely to provide data that is identical to that in the DB.

EDIT: This will be even more obvious if you ensure that the API that the DA layer presents is agnostic as to the actual source of the data, so you have methods like GetClientData, as opposed to GetClientDataFromDatabase
 
Back
Top Bottom