Re: t5: strategy for caching html output of component
yeah that's true in general . Good catch. However, I have a sessionid strippping filter in place so it doesn't effect me luckily. Andreas Andreou-4 wrote: > > As a note, one sideeffect i can think of would occur if the first > user (when cache doesn't yet exist) has cookies disabled (and thus > url-rewriting > takes place)... > > in that case, the cache would be filled in with urls > containing his specific JSESSIONID, e.t.c. > > On Wed, May 6, 2009 at 2:16 AM, Britske wrote: >> >> ok solved (don't know why I didn't see this earlier ;-) >> simply tested in template if cached html existed. >> if false --> render component >> if true --> use OutputRaw to output cached html of component. >> >> cheers, >> Britske >> >> >> >> Britske wrote: >>> >>> currently I'm working on a page with a lot of components. >>> >>> part of these components are lists with contents related to the visitor >>> viewing the page (i.e: last viewed products, product in wishlist) but >>> most >>> of these components display lists which are related to context of the >>> page >>> only (and are thus visitor-independent.) >>> >>> Because of: >>> a. rather big processing time of these components >>> b. pretty static nature of the visitor-independent components (changes >>> once a night) >>> c. limited nr of possible contexts >>> >>> it seems a good idea to wrap all visitor-independent components in a new >>> 'container component' of which I would like to cache the outputted html. >>> >>> Has anybody done something like this before, and if yes how? Are there >>> any >>> 'tapestry-ways' to go about it? >>> If not, in the basis I just need to know how to fetch the output of a >>> component as html, so I can insert it in memcached using the pagename+ >>> context as key. >>> >>> Thanks for you help, >>> Britske >>> >> >> -- >> View this message in context: >> http://www.nabble.com/t5%3A-strategy-for-caching-html-output-of-component-tp23394162p23397603.html >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > > > > -- > Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr > Tapestry / Tacos developer > Open Source / JEE Consulting > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > > -- View this message in context: http://www.nabble.com/t5%3A-strategy-for-caching-html-output-of-component-tp23394162p23403917.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: t5: strategy for caching html output of component
As a note, one sideeffect i can think of would occur if the first user (when cache doesn't yet exist) has cookies disabled (and thus url-rewriting takes place)... in that case, the cache would be filled in with urls containing his specific JSESSIONID, e.t.c. On Wed, May 6, 2009 at 2:16 AM, Britske wrote: > > ok solved (don't know why I didn't see this earlier ;-) > simply tested in template if cached html existed. > if false --> render component > if true --> use OutputRaw to output cached html of component. > > cheers, > Britske > > > > Britske wrote: >> >> currently I'm working on a page with a lot of components. >> >> part of these components are lists with contents related to the visitor >> viewing the page (i.e: last viewed products, product in wishlist) but most >> of these components display lists which are related to context of the page >> only (and are thus visitor-independent.) >> >> Because of: >> a. rather big processing time of these components >> b. pretty static nature of the visitor-independent components (changes >> once a night) >> c. limited nr of possible contexts >> >> it seems a good idea to wrap all visitor-independent components in a new >> 'container component' of which I would like to cache the outputted html. >> >> Has anybody done something like this before, and if yes how? Are there any >> 'tapestry-ways' to go about it? >> If not, in the basis I just need to know how to fetch the output of a >> component as html, so I can insert it in memcached using the pagename+ >> context as key. >> >> Thanks for you help, >> Britske >> > > -- > View this message in context: > http://www.nabble.com/t5%3A-strategy-for-caching-html-output-of-component-tp23394162p23397603.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: t5: strategy for caching html output of component
ok solved (don't know why I didn't see this earlier ;-) simply tested in template if cached html existed. if false --> render component if true --> use OutputRaw to output cached html of component. cheers, Britske Britske wrote: > > currently I'm working on a page with a lot of components. > > part of these components are lists with contents related to the visitor > viewing the page (i.e: last viewed products, product in wishlist) but most > of these components display lists which are related to context of the page > only (and are thus visitor-independent.) > > Because of: > a. rather big processing time of these components > b. pretty static nature of the visitor-independent components (changes > once a night) > c. limited nr of possible contexts > > it seems a good idea to wrap all visitor-independent components in a new > 'container component' of which I would like to cache the outputted html. > > Has anybody done something like this before, and if yes how? Are there any > 'tapestry-ways' to go about it? > If not, in the basis I just need to know how to fetch the output of a > component as html, so I can insert it in memcached using the pagename+ > context as key. > > Thanks for you help, > Britske > -- View this message in context: http://www.nabble.com/t5%3A-strategy-for-caching-html-output-of-component-tp23394162p23397603.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: t5: strategy for caching html output of component
ok, tried a couple of things, but none of them work: 1. in the container component keep track of the element that is created by the container component. in the afterRender fetch the html as element.toString() and put to cache. in the beginrender method check the cache and if found --> write to markupWriter using markwriter.addRaw(htmlFromCache); This gives an OOM-error since apparently Markupwriter doens't like having to construct so many dom elements all at once, 2. Better solution would be to use TextStreamResponse. However, I would like to return the html in this streamresponse in the same render methods of the component. However, I only seem to be able to return a streamresponse from an event method (such as onActivate, which seems the recommended way to render using StreamResponse) . Since a Component doesn't have a onActivate I'm out of luck. Ther is some metnion in earlier posts of using a page's onActivate to return a TextStreamResponse but I don't see how this could help me... any help is highly appreciated. Britske Britske wrote: > > currently I'm working on a page with a lot of components. > > part of these components are lists with contents related to the visitor > viewing the page (i.e: last viewed products, product in wishlist) but most > of these components display lists which are related to context of the page > only (and are thus visitor-independent.) > > Because of: > a. rather big processing time of these components > b. pretty static nature of the visitor-independent components (changes > once a night) > c. limited nr of possible contexts > > it seems a good idea to wrap all visitor-independent components in a new > 'container component' of which I would like to cache the outputted html. > > Has anybody done something like this before, and if yes how? Are there any > 'tapestry-ways' to go about it? > If not, in the basis I just need to know how to fetch the output of a > component as html, so I can insert it in memcached using the pagename+ > context as key. > > Thanks for you help, > Britske > -- View this message in context: http://www.nabble.com/t5%3A-strategy-for-caching-html-output-of-component-tp23394162p23397417.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
t5: strategy for caching html output of component
currently I'm working on a page with a lot of components. part of these components are lists with contents related to the visitor viewing the page (i.e: last viewed products, product in wishlist) but most of these components display lists which are related to context of the page only (and are thus visitor-independent.) Because of: a. rather big processing time of these components b. pretty static nature of the visitor-independent components (changes once a night) c. limited nr of possible contexts it seems a good idea to wrap all visitor-independent components in a new 'container component' of which I would like to cache the outputted html. Has anybody done something like this before, and if yes how? Are there any 'tapestry-ways' to go about it? If not, in the basis I just need to know how to fetch the output of a component as html, so I can insert it in memcached using the pagename+ context as key. Thanks for you help, Britske -- View this message in context: http://www.nabble.com/t5%3A-strategy-for-caching-html-output-of-component-tp23394162p23394162.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org