From: Lane S. <la...@op...> - 2004-05-25 06:07:39
|
Hi Lars, As ebr pointed out, you can consider the #cache directive as well. This is in the contrib/ distro and you will probably want to consider this as well. I almost exclusively use templets because of the inherent ability to pass in parameters. templets are extremely compelling to use in new template development. I discuss this at http://webmacro.org/BlockLevelExpressionism I have a global file, global.tml which includes parts.tml. global.tml is evaluated once or on a refresh and is always made available in the context. See the current cvs image for o.w.servlets.TemplateServlet.init(). Be sure to look at how this servlet manages a global context. Then, consider the opening lines of a parts.tml, inccluded from global.tml: #include as macro "includes/macros.wmm" #bean $site = "org.webmacro.util.SparseProperties" scope=global ## site parameters: #bean $site.ServiceStarted = "java.util.Date" #bean $site.StorageService = "org.opendoors.vlh.VLHProvider" scope=static #set $site.SMTPServer = "@MailServer@" #set $site.SupportAddress = ["la...@op..."] #set $site.SalesAddress = ["sa...@op..."] #set $site.FromAddress = "su...@op..." #set $site.BlackMailURL = "http://www.computerworld.com/securitytopics/security/cybercrime/story/0,10801,88623,00.html" #templet $site.PageFooter { <DIV id="pageFooter"> [#hrefInDialog("/privacy.html","Privacy")] [#hrefInDialog("/contact.html", "Contact Us")] </DIV> } It is pretty clear that I am using $site as a cache and using #bean to instantiate the type of cache I want to use. -Lane Lars George wrote: > Hi Lane, > > OK, I get it, that is an approach. That way I add my own CachingTool > and use it where I need it. Getting the scope etc. supported should > not be much more complicated I assume. > > The other question of course is if that would not be a good feature > for WebMacro's core as well. In general the question is what is the > way to go, using templets or blocks. > > Thanks, > Lars > > > Lane Sharman wrote: > >> Hi, >> >> With WM, you can have an object like $WMCache in the context. Then, >> as you evaluate a templet into a string variable, you can place the >> string variable into the $WMCache. The next time around, you can test >> for its existence subject to a lot of criteria such as user, session, >> time, invalidation, etc, etc. >> >> -Lane >> >> >> >> >> Brian Goetz wrote: >> >>> You've addressed half of Lars' question -- the caching infrastructure >>> -- but not the other half -- the integration of caching into the >>> template language. The approach taken by OSCache is quite cool, in >>> that allows JSP writers to specify the interaction of caching and >>> content quite nicely. >>> >>>> 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. >>>> >>> > > > > > ------------------------------------------------------- > 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 |