From: Lane S. <la...@op...> - 2004-05-24 06:10:16
|
Hi Lars, Caching has been discussed a lot and there is a caching provider interface so you can write your own caching implementation. (As I have done). To cache individual objects, you can use a global service model to cache individual templates (eg, connection.wmt, statements.wmt, etc.) and objects (queryResultReference, queryResultDomain, queryResultTransaction, etc). With this kind of a model, you cache both the template elements and the results according to memory and invalidation events. I have done all of the above for http://www.opendoors.com Good luck. Kindest, lane Lars George wrote: > Hi, > > I had a look at OSCache the other day and noticed their Cache Tag > support which allows you to wrap a piece of code in a JSP and have it > cached for a configurable ammount of time: > > http://www.opensymphony.com/oscache/tags.html > > Well, I thought, wouldn't that be a cool feature in WebMacro if we > could cache a evaluated piece for a certain amount of time? There are > a couple of ways to do it of course and even the caching would need to > be implemented somehow, but I think it cannot be too difficult and > before having a go at it I thought what you guys think of it. > > One option would be to specify a Cache Interface class with the > necessary functionality and then implement it as required. For > instance one could use a special proxy/wrapper class to wrap OSCache > into the infrastructure. The classname for the proxy/wrapper class and > basic settings could be specified in the WebMacro.properties file. > > Then the Eval directive could be enhanced to handle the cache support, > eg. > > #eval $listCart using { "cart": $myCart } cache { "timeout": 600, > "scope": "session" ... } > > using similar parameters as seen above in the OSCache cache tag. > > Then all the Eval directive would have to do is check if the cache > params are given and a cache proxy class is specified in the settings > file and then get the previously evaluated content from the cache or > store it there. > > Of course, if the WebMacro internal cache is already prepared to > handle this sort of extra work, then even better but since I started > with OSCache and know that they have all that "scope" stuff already > implemented, then why doing it again. > > Maybe there is even another way to cache pieces of evaluated template > using something like the block code, eg. > > #cache { "timeout": ... } #begin > > normal template code here > > #end > > But since I am not fully aware of which is the easier implementation > of the two I would love to hear what you guys suggest. > > Why all this effort? Well, I started "poluting" the code in a lot of > places to cache for instance database records that hardly change so > that next time the WebMacro tool which fills the template is called it > uses the cached information instead of hitting the database again. It > is an obvious choice because it gives the front-end page generator a > choice to get fresh or cached data where ever needed. When that > happens auto-magically in the backend then there is no control from > the presentation layer and the only choice to solve this is to add > extra params to the custom WebMacro tool calls which allows to specify > this. > > I thnk these are more than enough reasons to do it. ;-) > > Let me know what you think. > > Cheers, > Lars > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle > 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Webmacro-user mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webmacro-user > -- Lane Sharman Providing Private and SPAM-Free Email http://www.opendoors.com 858-755-2868 |