You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Dariusz Wojtas <dw...@gmail.com> on 2007/08/05 15:17:31 UTC

Caching components

Hi,

Is it possible to cache some component output?
Sometimes we know that some custom component output does not depend on the
browser and changes very rarely. But generating it every time may be very
costly.

What is the background?
I have a topMenu component, which depends on database, but does not change
once started.
Or I have a productCategories component, it requires several DB calls to
render, but I would love to cache it's output per parentID as it does not
change once rendered.

Is there any way to tell the component to cache somewhere it's output? Some
method that may be overriden and give rendering hint?

Other question.
What I can see in examples is that usually all components are added to a
page in it's constructor.
Is it allowed to use cached instances of components?
Are they thread safe by default (if I do not break it myself)?
Is it allowed to add a component instance to multiple other objects at the
same time?

I cannot find such info anywhere in wiki.
Any hint in this area would be helpful.

Regards
Dariusz Wojtas
-- 
View this message in context: http://www.nabble.com/Caching-components-tf4219802.html#a12004616
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Caching components

Posted by Igor Vaynberg <ig...@gmail.com>.
usually component render is cheap - it is the retrieval of model data
that drives the render that is expensive. so you should cache this
data rather then the component output.

-igor


On 8/5/07, Dariusz Wojtas <dw...@gmail.com> wrote:
>
> Hi,
>
> Is it possible to cache some component output?
> Sometimes we know that some custom component output does not depend on the
> browser and changes very rarely. But generating it every time may be very
> costly.
>
> What is the background?
> I have a topMenu component, which depends on database, but does not change
> once started.
> Or I have a productCategories component, it requires several DB calls to
> render, but I would love to cache it's output per parentID as it does not
> change once rendered.
>
> Is there any way to tell the component to cache somewhere it's output? Some
> method that may be overriden and give rendering hint?
>
> Other question.
> What I can see in examples is that usually all components are added to a
> page in it's constructor.
> Is it allowed to use cached instances of components?
> Are they thread safe by default (if I do not break it myself)?
> Is it allowed to add a component instance to multiple other objects at the
> same time?
>
> I cannot find such info anywhere in wiki.
> Any hint in this area would be helpful.
>
> Regards
> Dariusz Wojtas
> --
> View this message in context: http://www.nabble.com/Caching-components-tf4219802.html#a12004616
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org