From: Lars G. <la...@wo...> - 2004-05-25 05:51:25
|
Hi Eric, Cool, that seems like nearly what I was after. Is that code still up-to-date with the latest code? How difficult would it be to hand in the cache params as I suggested, eg. #cache { "timeout": 600, "scope": "session", ... } #begin ... #end Do you think that would work or not? I have the feeling that the block style is a lot more intuitive and useful then using a CachingTool and to cache templets manually. The reason is that with blocks they can be wrapped in existing templates very easily, but with templets first you need the latest code and also the syntax is not as intuitive - sorry, no offense meant. I mean, you have to define the templets first and then sort of include them where they should. If the block style as Eric has started works then you can even wrap the #eval call an cache any templet ;-) Thanks, Lars Eric B. Ridge wrote: > On 5/24/04 12:08 AM, "Lars George" <la...@wo...> 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 > > > A long long time ago, I started on a #cache directive. It's still in our > CVS /contrib tree: > http://cvs.sourceforge.net/viewcvs.py/webmacro/contrib/CacheDirective/ > > You might find it as a good starting point. > > eric > > >>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 > > > > > ------------------------------------------------------- > 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 > |