caching the sql queries

Gerhard Häring gh at ghaering.de
Mon Sep 15 09:02:51 EDT 2003


Syver Enstad wrote:
> Gerhard Häring <gh at ghaering.de> writes:
>>In my opinion, this sort of caching should really be done in the
>>application layer, not in the database access layer.
> 
> I didn't know that PHP programmers used layers at all :-) 
> 
> On a more serious note, Why do you think caching should be
> implemented in the application layer (is this the same as the
> domain/business layer) rather than the database access layer?

Yes, a dozen different terms for the same thing ;)

It's mostly gut feeling about what's the right approach, which has 
served me well quite often :-)

If I needed to state reasons, I'd say that the business layer can assure 
data consistency, while with this simplistic approach, the database 
layer (*) cannot.

-- Gerhard

(*) "database access layer" may sound like something important, but in 
my projects, it's only a thin layer on top of DB-API/ADO.NET/... that 
provides shortcuts for the most common use cases and allows switching 
database backends more easily.





More information about the Python-list mailing list