That's a good point. I would have assumed a

<span jwcid="@Insert" value="ognl:theTimestamp" /> on 5 different locations 
inside a page would return exactly the same timestamp as Tapestry "assumes" 
that all identical ognl expressions are the same and the expression is only 
evaluated once before rendering the page.

If, however, the the ognl expressions are evaluated one by one and while the 
templates are being parsed, this would lead to different timestamps.

My idea was, that the steps are the following:

1. extraction of the ognl expresions inside a page template and evaluating 
them....temporarily storing the values.

2. rendering the templates using the values from 1.



-------- Original-Nachricht --------
Datum: Fri, 9 Feb 2007 18:01:09 -0500
Von: "James Carman" <[EMAIL PROTECTED]>
An: "Tapestry users" <users@tapestry.apache.org>
CC: 
Betreff: Re: Tapestry & Hivemind: Caching multiple method calls per request?

> Tapestry would have to know what's inside the method to know that it
> will always return the same thing.  This method doesn't return the
> same thing all the time:
> 
> public String getTimestamp()
> {
>   return String.valueOf( System.currentTimeMillis() );
> }
> 
> 
> 
> On 2/9/07, Tobias Marx <[EMAIL PROTECTED]> wrote:
> > Indepenent of what the method looks like, why is it called more then
> once anyhow?
> >
> > If there is the same method inside a page or component, I thought
> Tapestry retrieves all the data first and then "intelligently" parses all the
> pages and its component templates and notices if the same method is called
> several times?
> >
> > Now it seems like it goes through all templates line by line and then
> calls the methods every time it encounteres them without "an eye" for the
> page scope?
> >
> > If I define a class as threaded in Hivemind, doesnt Tapestry "know" that
> the method will always return the same result if it appears 100 times
> inside a page or component?
> >
> > If there is an injected method in some components and pages that
> references a threaded Hivemind class.....it is always the same call and 
> therefore
> Tapestry would only need to call it once and use the same result for all
> components?
> >
> >
> > Thanks!
> >
> > Toby
> >
> > -------- Original-Nachricht --------
> > Datum: Fri, 9 Feb 2007 10:24:05 -0500
> > Von: "James Carman" <[EMAIL PROTECTED]>
> > An: "Tapestry users" <users@tapestry.apache.org>
> > CC:
> > Betreff: Re: Tapestry & Hivemind: Caching multiple method calls per
> request?
> >
> > > What does the method that fetches the domain object look like?  Does
> > > it cache its results or does it call the IDomainSource every time?
> > >
> > > On 2/9/07, Tobias Marx <[EMAIL PROTECTED]> wrote:
> > > > Hi there!
> > > >
> > > > I am using Hivemind to generate a Map of Domain name related objects
> as
> > > a singleton on startup, called HibernateDomainSource.
> > > >
> > > > Then I am constructing a threaded services that uses this data
> > > > together with the servletRequest. This service is called
> DomainManager.
> > > >
> > > > I am now injecting the DomainManager into my base component in order
> to
> > > access a domain object from the HibernateDomainSource that corresponds
> to
> > > the domain name from the servlet Request.
> > > >
> > > > <service-point id="HibernateDomainSource"
> > > interface="tm.framework.services.interfaces.IDomainSource">
> > > >                 <invoke-factory model="singleton">
> > > >                         <construct
> > > class="tm.framework.services.HibernateDomainSource">
> > > >                                 <set-service
> > > property="templatePersistenceService"
> service-id="TemplatePersistenceService"/>
> > > >                         </construct>
> > > >                 </invoke-factory>
> > > >
> > > >         </service-point>
> > > >
> > > >         <service-point id="DomainManager"
> > > interface="tm.framework.services.interfaces.DomainManager">
> > > >                 <invoke-factory model="threaded">
> > > >                         <construct
> > > class="tm.framework.services.DomainManagerImpl">
> > > >                                 <set-service property="domainSource"
> > > service-id="HibernateDomainSource"/>
> > > >                                 <set-service
> property="servletRequest"
> > > service-id="tapestry.globals.HttpServletRequest" />
> > > >                         </construct>
> > > >                 </invoke-factory>
> > > >         </service-point>
> > > >
> > > > The "problem" now is, that the DomainManager method that fetches the
> > > domain object from the map is called several times during a single
> page
> > > request.
> > > >
> > > > Is there a way to force it to only fetch it once per page request?
> > > >
> > > > Thanks!
> > > >
> > > > Toby
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to