tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reynir Hübner <rey...@hugsmidjan.is>
Subject RE: Query Caching
Date Sat, 29 Sep 2001 15:45:56 GMT
 

One of ideas of the MVC pattern/architecture (MODEL/VIEW/CONTROLLER) is
to keep the buisnesslogic out of the presentation logic and vice versa.
This means keep what the controller should be doing (such as data
manipulation, etc.) out of what the view should be doing - present your
data in some format. Some people are using the JSP page as a controller
and the tags as buisnesslogic to be preformed and then in the end use
the JSP page also as view.

this means the JSP layer serves both the controller and view purpose.
The results of usage like this is the fact that the View layer of the
model can come very expensive, holding all the logic both for
presentation and most of the buisnesslogic too. This means if your
website want´s to change it´s layout, or maybe start some service using
XML or WML or something like that, you must implement all the
buisnesslogic again for those different layouts. Also if you wanted to
change the database you want to use, for example port your application
from using Oracle over to useing MySQL you will have to change the
presentation layer (that is if you use some oracle specific
functionality), and probably everything else in your app, at least you
would have to change the tags that interact with the server. And if you
are using 3rd party tags you get into troubles there...Maybe in some
projects it´s not relevant, and there for its alrigth to use db-tags or
what ever other functionality inside JSP pages. I cannot see that as
"not breaking the MVC idealogy".

 
 

-----Original Message-----
From: Stacy Young [mailto:Stacy.Young@sfcommerce.com]
Sent: 28. september 2001 23:47
To: 'taglibs-user@jakarta.apache.org'
Subject: RE: Query Caching



Breaks MVC? Not mine! (Fusebox) 


-----Original Message----- 
From: Geoff Lane [ mailto:glane@inclusion.net] 
Sent: Friday, September 28, 2001 6:52 PM 
To: taglibs-user@jakarta.apache.org 
Subject: Re: Query Caching 


Slightly off topic - but I've noticed A LOT of the traffic on this list
is about the DB Tag related stuff. Am I the only one who thinks that the
whole idea of DB tags (for anything other than a very trivial site) is
really a Bad Idea?

It just seems to me that the domain of storage and retrieval lies way
outside the domain of display. I'm willing to hear opinions on why
people use these - but they totally break MVC (which not everyone cares
about I admit).

And - if the queries where being done in regular Java and only being
accessed from Tag Labraries - then adding a layer of caching with a
WeakHashmap or something would be rather trivial - then you'd just have
a little penalty on a cache miss of having to do the query and add the
value back into the cache.

On that note - you might be able to sub class the DB Tags to have the
caching done based on the Query and some parameters passed in.
Basically, you'd need a singleton instance of the Cache class so that
all the tags could reference the same object (guess you'd need to do
some synchronizing on the object whenever you updated the cache). Not
sure if singletons get GCed - since they keep a reference to an instance
of themselves - one for someone who knows a lot more about the details
of the VM than me.

Maybe a starting point at least . . . 

On Fri, 2001-09-28 at 16:58, Stacy Young wrote: 
> Is there a taglib that supports query caching? Say for isntance I'm 
> using a SQL Taglib to execute a database query, I'd like to hold the 
> results in memory for X amount of time so subsequent queries of the 
> same "id" are pulled from memory and not another trip to the DB. 
> 
> Thanks! 
> 
> Stacy Young 
> Surefire Commerce 
> tel: 514-380-2700 ext 3234 
> http://www.surefirecommerce.com < http://www.surefirecommerce.com> 
> 
> "It all started with a Mouse." -Walt Disney 
> 
-- 
Geoff Lane <glane@inclusion.net> 
Ph: (773) 972-7136 
PGP Key: http://www.frognet.net/~glane/key.html 


Mime
View raw message