You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Daniel Frisk <da...@jalbum.net> on 2009/03/27 16:49:48 UTC

Caching of rendered panels

I have a situation where I have some panels which I want to render say  
at most once a minute and during that period they should be "static".  
I tried a few approches which hasn't really worked out for me so I  
wanted to know if somebody has created such a thing or how this could  
be done. Ideas are also welcome...

// Daniel Frisk
jalbum.net

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


Re: Caching of rendered panels

Posted by Igor Vaynberg <ig...@gmail.com>.
normally you should cache your model, the rendering itself is very cheap.

-igor

On Fri, Mar 27, 2009 at 8:49 AM, Daniel Frisk <da...@jalbum.net> wrote:
> I have a situation where I have some panels which I want to render say at
> most once a minute and during that period they should be "static". I tried a
> few approches which hasn't really worked out for me so I wanted to know if
> somebody has created such a thing or how this could be done. Ideas are also
> welcome...
>
> // Daniel Frisk
> jalbum.net
>
> ---------------------------------------------------------------------
> 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


Re: Caching of rendered panels

Posted by Igor Vaynberg <ig...@gmail.com>.
if you dont mind putting this into a wrapper there is a
containertransformer or something like that.

-igor

On Sat, Mar 28, 2009 at 1:13 AM, Daniel Frisk <da...@jalbum.net> wrote:
> Great ideas! I think I will try to implement it is a WebComponent decorator
> that can wrap a component and add the caching. I'll let you know if it works
> out for me.
>
> // Daniel
> jalbum.net
>
>
>
> On 2009-03-27, at 20:40, Matej Knopp wrote:
>
>> You have to be really brave to use IComponentSource :-)
>>
>> It's almost never a good idea anyway. It makes sense if you have
>> container with big amount of small component and you can restore the
>> whole hierarchy from e.g. an entity Id.
>>
>> but it was last time used with Wicket 1.3. There's not guarantee it will
>> work...
>>
>> -Matej
>>
>> On Fri, Mar 27, 2009 at 8:13 PM, Igor Vaynberg <ig...@gmail.com>
>> wrote:
>>>
>>> ive never had to do this, but maybe something like this will work :)
>>>
>>> class myheavypanel implements icomponentsource {
>>>  private String cache;
>>>
>>>  public Component restoreComponent(String id) {
>>>    if (cache==null) {
>>>      return this;
>>>    } else  {
>>>       return new label(id, cache).setescapemarkup(false);
>>>   }
>>>  }
>>>
>>>  public myheavypanel() {
>>>    .....
>>>    add(new abstracttransformbehavor() {
>>>        public abstract CharSequence transform(final Component
>>> component, final CharSequence output) {
>>>           myheavypanel.this.cache=output;
>>>           return output;
>>>        }});
>>>  }
>>>
>>> }
>>>
>>>
>>> its kinda hacky but might work :)
>>>
>>> -igor
>>>
>>> On Fri, Mar 27, 2009 at 11:50 AM, Daniel Frisk <da...@jalbum.net> wrote:
>>>>
>>>> In our case it's not really that the rendering itself is taking to long,
>>>> it
>>>> is getting the data from the model (database) so your advice is in some
>>>> sense correct. Restructuring the code so that we can efficently cache
>>>> the
>>>> model is a lot of work and I would prefer to somehow cache the rendered
>>>> html.
>>>>
>>>> So if we presume that I actually know what I am doing, any ideas how it
>>>> can
>>>> be done?
>>>>
>>>> // Daniel
>>>>
>>>>
>>>> On 2009-03-27, at 19:23, Jeremy Thomerson wrote:
>>>>
>>>>> Don't share component instances across requests / especially sessions.
>>>>> Don't prematurely optimize.
>>>>>
>>>>> Cache your model and test the rendering.  If it really is taking too
>>>>> long,
>>>>> figure out why and worry about it then.
>>>>>
>>>>> --
>>>>> Jeremy Thomerson
>>>>> http://www.wickettraining.com
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Mar 27, 2009 at 1:12 PM, Martin Grotzke <
>>>>> martin.grotzke@javakaffee.de> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I also thought about s.th. like this because we'll have very complex
>>>>>> component graphs that have to be composed dynamically based on the
>>>>>> language of the user and ~3 other things. I thought about caching
>>>>>> complete component instances, but didn't come so far that I thought
>>>>>> about how this could be integrated into wicket - perhaps dead simple
>>>>>> via
>>>>>> some
>>>>>> _cacheService.getReallyComplexComponentCached( "complexComponent",
>>>>>> userInfo )
>>>>>>
>>>>>> I don't know how cheap exactly rendering of our complex component
>>>>>> structure will be, but if this would take more than say 10 millis we
>>>>>> would also try to cache already rendered markup.
>>>>>>
>>>>>> Cheers,
>>>>>> Martin
>>>>>>
>>>>>>
>>>>>> On Fri, 2009-03-27 at 16:49 +0100, Daniel Frisk wrote:
>>>>>>>
>>>>>>> I have a situation where I have some panels which I want to render
>>>>>>> say
>>>>>>> at most once a minute and during that period they should be "static".
>>>>>>> I tried a few approches which hasn't really worked out for me so I
>>>>>>> wanted to know if somebody has created such a thing or how this could
>>>>>>> be done. Ideas are also welcome...
>>>>>>>
>>>>>>> // Daniel Frisk
>>>>>>> jalbum.net
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> 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
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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


Re: Caching of rendered panels

Posted by Daniel Frisk <da...@jalbum.net>.
Great ideas! I think I will try to implement it is a WebComponent  
decorator that can wrap a component and add the caching. I'll let you  
know if it works out for me.

// Daniel
jalbum.net



On 2009-03-27, at 20:40, Matej Knopp wrote:

> You have to be really brave to use IComponentSource :-)
>
> It's almost never a good idea anyway. It makes sense if you have
> container with big amount of small component and you can restore the
> whole hierarchy from e.g. an entity Id.
>
> but it was last time used with Wicket 1.3. There's not guarantee it  
> will work...
>
> -Matej
>
> On Fri, Mar 27, 2009 at 8:13 PM, Igor Vaynberg <igor.vaynberg@gmail.com 
> > wrote:
>> ive never had to do this, but maybe something like this will work :)
>>
>> class myheavypanel implements icomponentsource {
>>  private String cache;
>>
>>  public Component restoreComponent(String id) {
>>     if (cache==null) {
>>       return this;
>>     } else  {
>>        return new label(id, cache).setescapemarkup(false);
>>    }
>>  }
>>
>>  public myheavypanel() {
>>     .....
>>     add(new abstracttransformbehavor() {
>>         public abstract CharSequence transform(final Component
>> component, final CharSequence output) {
>>            myheavypanel.this.cache=output;
>>            return output;
>>         }});
>>   }
>>
>> }
>>
>>
>> its kinda hacky but might work :)
>>
>> -igor
>>
>> On Fri, Mar 27, 2009 at 11:50 AM, Daniel Frisk <da...@jalbum.net>  
>> wrote:
>>> In our case it's not really that the rendering itself is taking to  
>>> long, it
>>> is getting the data from the model (database) so your advice is in  
>>> some
>>> sense correct. Restructuring the code so that we can efficently  
>>> cache the
>>> model is a lot of work and I would prefer to somehow cache the  
>>> rendered
>>> html.
>>>
>>> So if we presume that I actually know what I am doing, any ideas  
>>> how it can
>>> be done?
>>>
>>> // Daniel
>>>
>>>
>>> On 2009-03-27, at 19:23, Jeremy Thomerson wrote:
>>>
>>>> Don't share component instances across requests / especially  
>>>> sessions.
>>>> Don't prematurely optimize.
>>>>
>>>> Cache your model and test the rendering.  If it really is taking  
>>>> too long,
>>>> figure out why and worry about it then.
>>>>
>>>> --
>>>> Jeremy Thomerson
>>>> http://www.wickettraining.com
>>>>
>>>>
>>>>
>>>> On Fri, Mar 27, 2009 at 1:12 PM, Martin Grotzke <
>>>> martin.grotzke@javakaffee.de> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I also thought about s.th. like this because we'll have very  
>>>>> complex
>>>>> component graphs that have to be composed dynamically based on the
>>>>> language of the user and ~3 other things. I thought about caching
>>>>> complete component instances, but didn't come so far that I  
>>>>> thought
>>>>> about how this could be integrated into wicket - perhaps dead  
>>>>> simple via
>>>>> some
>>>>> _cacheService.getReallyComplexComponentCached( "complexComponent",
>>>>> userInfo )
>>>>>
>>>>> I don't know how cheap exactly rendering of our complex component
>>>>> structure will be, but if this would take more than say 10  
>>>>> millis we
>>>>> would also try to cache already rendered markup.
>>>>>
>>>>> Cheers,
>>>>> Martin
>>>>>
>>>>>
>>>>> On Fri, 2009-03-27 at 16:49 +0100, Daniel Frisk wrote:
>>>>>>
>>>>>> I have a situation where I have some panels which I want to  
>>>>>> render say
>>>>>> at most once a minute and during that period they should be  
>>>>>> "static".
>>>>>> I tried a few approches which hasn't really worked out for me  
>>>>>> so I
>>>>>> wanted to know if somebody has created such a thing or how this  
>>>>>> could
>>>>>> be done. Ideas are also welcome...
>>>>>>
>>>>>> // Daniel Frisk
>>>>>> jalbum.net
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> 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
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: Caching of rendered panels

Posted by Matej Knopp <ma...@gmail.com>.
You have to be really brave to use IComponentSource :-)

It's almost never a good idea anyway. It makes sense if you have
container with big amount of small component and you can restore the
whole hierarchy from e.g. an entity Id.

but it was last time used with Wicket 1.3. There's not guarantee it will work...

-Matej

On Fri, Mar 27, 2009 at 8:13 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> ive never had to do this, but maybe something like this will work :)
>
> class myheavypanel implements icomponentsource {
>  private String cache;
>
>  public Component restoreComponent(String id) {
>     if (cache==null) {
>       return this;
>     } else  {
>        return new label(id, cache).setescapemarkup(false);
>    }
>  }
>
>  public myheavypanel() {
>     .....
>     add(new abstracttransformbehavor() {
>         public abstract CharSequence transform(final Component
> component, final CharSequence output) {
>            myheavypanel.this.cache=output;
>            return output;
>         }});
>   }
>
> }
>
>
> its kinda hacky but might work :)
>
> -igor
>
> On Fri, Mar 27, 2009 at 11:50 AM, Daniel Frisk <da...@jalbum.net> wrote:
>> In our case it's not really that the rendering itself is taking to long, it
>> is getting the data from the model (database) so your advice is in some
>> sense correct. Restructuring the code so that we can efficently cache the
>> model is a lot of work and I would prefer to somehow cache the rendered
>> html.
>>
>> So if we presume that I actually know what I am doing, any ideas how it can
>> be done?
>>
>> // Daniel
>>
>>
>> On 2009-03-27, at 19:23, Jeremy Thomerson wrote:
>>
>>> Don't share component instances across requests / especially sessions.
>>> Don't prematurely optimize.
>>>
>>> Cache your model and test the rendering.  If it really is taking too long,
>>> figure out why and worry about it then.
>>>
>>> --
>>> Jeremy Thomerson
>>> http://www.wickettraining.com
>>>
>>>
>>>
>>> On Fri, Mar 27, 2009 at 1:12 PM, Martin Grotzke <
>>> martin.grotzke@javakaffee.de> wrote:
>>>
>>>> Hi,
>>>>
>>>> I also thought about s.th. like this because we'll have very complex
>>>> component graphs that have to be composed dynamically based on the
>>>> language of the user and ~3 other things. I thought about caching
>>>> complete component instances, but didn't come so far that I thought
>>>> about how this could be integrated into wicket - perhaps dead simple via
>>>> some
>>>> _cacheService.getReallyComplexComponentCached( "complexComponent",
>>>> userInfo )
>>>>
>>>> I don't know how cheap exactly rendering of our complex component
>>>> structure will be, but if this would take more than say 10 millis we
>>>> would also try to cache already rendered markup.
>>>>
>>>> Cheers,
>>>> Martin
>>>>
>>>>
>>>> On Fri, 2009-03-27 at 16:49 +0100, Daniel Frisk wrote:
>>>>>
>>>>> I have a situation where I have some panels which I want to render say
>>>>> at most once a minute and during that period they should be "static".
>>>>> I tried a few approches which hasn't really worked out for me so I
>>>>> wanted to know if somebody has created such a thing or how this could
>>>>> be done. Ideas are also welcome...
>>>>>
>>>>> // Daniel Frisk
>>>>> jalbum.net
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>
>>
>
> ---------------------------------------------------------------------
> 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


Re: Caching of rendered panels

Posted by Igor Vaynberg <ig...@gmail.com>.
ive never had to do this, but maybe something like this will work :)

class myheavypanel implements icomponentsource {
  private String cache;

  public Component restoreComponent(String id) {
     if (cache==null) {
       return this;
     } else  {
        return new label(id, cache).setescapemarkup(false);
    }
  }

  public myheavypanel() {
     .....
     add(new abstracttransformbehavor() {
         public abstract CharSequence transform(final Component
component, final CharSequence output) {
            myheavypanel.this.cache=output;
            return output;
         }});
   }

}


its kinda hacky but might work :)

-igor

On Fri, Mar 27, 2009 at 11:50 AM, Daniel Frisk <da...@jalbum.net> wrote:
> In our case it's not really that the rendering itself is taking to long, it
> is getting the data from the model (database) so your advice is in some
> sense correct. Restructuring the code so that we can efficently cache the
> model is a lot of work and I would prefer to somehow cache the rendered
> html.
>
> So if we presume that I actually know what I am doing, any ideas how it can
> be done?
>
> // Daniel
>
>
> On 2009-03-27, at 19:23, Jeremy Thomerson wrote:
>
>> Don't share component instances across requests / especially sessions.
>> Don't prematurely optimize.
>>
>> Cache your model and test the rendering.  If it really is taking too long,
>> figure out why and worry about it then.
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>>
>> On Fri, Mar 27, 2009 at 1:12 PM, Martin Grotzke <
>> martin.grotzke@javakaffee.de> wrote:
>>
>>> Hi,
>>>
>>> I also thought about s.th. like this because we'll have very complex
>>> component graphs that have to be composed dynamically based on the
>>> language of the user and ~3 other things. I thought about caching
>>> complete component instances, but didn't come so far that I thought
>>> about how this could be integrated into wicket - perhaps dead simple via
>>> some
>>> _cacheService.getReallyComplexComponentCached( "complexComponent",
>>> userInfo )
>>>
>>> I don't know how cheap exactly rendering of our complex component
>>> structure will be, but if this would take more than say 10 millis we
>>> would also try to cache already rendered markup.
>>>
>>> Cheers,
>>> Martin
>>>
>>>
>>> On Fri, 2009-03-27 at 16:49 +0100, Daniel Frisk wrote:
>>>>
>>>> I have a situation where I have some panels which I want to render say
>>>> at most once a minute and during that period they should be "static".
>>>> I tried a few approches which hasn't really worked out for me so I
>>>> wanted to know if somebody has created such a thing or how this could
>>>> be done. Ideas are also welcome...
>>>>
>>>> // Daniel Frisk
>>>> jalbum.net
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>
>

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


Re: Caching of rendered panels

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Even supposing that you don't already have some other cache engine built
into your app somewhere, couldn't you build a simple caching model class
much easier than caching rendered HTML.  To cache the rendered HTML you
must:

1 - on request one, create the component, render it, cache the rendered
HTML, output it
2 - on request two, not create the component, find the rendered HTML, use a
label or something to render the html instead

Perhaps you could easily just create a caching model that wraps another
model and uses ehcache.  It would be fairly simple:

See http://ehcache.sourceforge.net/samples.html

(pseudo-code)

class CachingModel<T> extends LoadableDetachableModel<T> {

    final String cacheKey;
    final IModel<T> model;
    public CachingModel(String cacheKey, IModel<T> model) {
        this.model = model;
        this.cacheKey = cacheKey;
    }

    @Override
    public T load() {
        Cache cache =
CacheManager.getInstance().getCache(getClass().getSimpleName());
        Element elem = cache.getElement(this.cacheKey);
        if (elem == null) {
            elem = new Element(this.cacheKey, this.model.getObject());
            cache.put(elem);
        }
        return elem.getObjectValue();
    }

    @Override
    public void onDetach() {
        super.onDetach();
        this.model.detach();
    }
}

--
Jeremy Thomerson
http://www.wickettraining.com



On Fri, Mar 27, 2009 at 1:50 PM, Daniel Frisk <da...@jalbum.net> wrote:

> In our case it's not really that the rendering itself is taking to long, it
> is getting the data from the model (database) so your advice is in some
> sense correct. Restructuring the code so that we can efficently cache the
> model is a lot of work and I would prefer to somehow cache the rendered
> html.
>
> So if we presume that I actually know what I am doing, any ideas how it can
> be done?
>
> // Daniel
>
>
>
> On 2009-03-27, at 19:23, Jeremy Thomerson wrote:
>
>  Don't share component instances across requests / especially sessions.
>> Don't prematurely optimize.
>>
>> Cache your model and test the rendering.  If it really is taking too long,
>> figure out why and worry about it then.
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>>
>> On Fri, Mar 27, 2009 at 1:12 PM, Martin Grotzke <
>> martin.grotzke@javakaffee.de> wrote:
>>
>>  Hi,
>>>
>>> I also thought about s.th. like this because we'll have very complex
>>> component graphs that have to be composed dynamically based on the
>>> language of the user and ~3 other things. I thought about caching
>>> complete component instances, but didn't come so far that I thought
>>> about how this could be integrated into wicket - perhaps dead simple via
>>> some
>>> _cacheService.getReallyComplexComponentCached( "complexComponent",
>>> userInfo )
>>>
>>> I don't know how cheap exactly rendering of our complex component
>>> structure will be, but if this would take more than say 10 millis we
>>> would also try to cache already rendered markup.
>>>
>>> Cheers,
>>> Martin
>>>
>>>
>>> On Fri, 2009-03-27 at 16:49 +0100, Daniel Frisk wrote:
>>>
>>>> I have a situation where I have some panels which I want to render say
>>>> at most once a minute and during that period they should be "static".
>>>> I tried a few approches which hasn't really worked out for me so I
>>>> wanted to know if somebody has created such a thing or how this could
>>>> be done. Ideas are also welcome...
>>>>
>>>> // Daniel Frisk
>>>> jalbum.net
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>
>

Re: Caching of rendered panels

Posted by Daniel Frisk <da...@jalbum.net>.
In our case it's not really that the rendering itself is taking to  
long, it is getting the data from the model (database) so your advice  
is in some sense correct. Restructuring the code so that we can  
efficently cache the model is a lot of work and I would prefer to  
somehow cache the rendered html.

So if we presume that I actually know what I am doing, any ideas how  
it can be done?

// Daniel


On 2009-03-27, at 19:23, Jeremy Thomerson wrote:

> Don't share component instances across requests / especially sessions.
> Don't prematurely optimize.
>
> Cache your model and test the rendering.  If it really is taking too  
> long,
> figure out why and worry about it then.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Fri, Mar 27, 2009 at 1:12 PM, Martin Grotzke <
> martin.grotzke@javakaffee.de> wrote:
>
>> Hi,
>>
>> I also thought about s.th. like this because we'll have very complex
>> component graphs that have to be composed dynamically based on the
>> language of the user and ~3 other things. I thought about caching
>> complete component instances, but didn't come so far that I thought
>> about how this could be integrated into wicket - perhaps dead  
>> simple via
>> some
>> _cacheService.getReallyComplexComponentCached( "complexComponent",
>> userInfo )
>>
>> I don't know how cheap exactly rendering of our complex component
>> structure will be, but if this would take more than say 10 millis we
>> would also try to cache already rendered markup.
>>
>> Cheers,
>> Martin
>>
>>
>> On Fri, 2009-03-27 at 16:49 +0100, Daniel Frisk wrote:
>>> I have a situation where I have some panels which I want to render  
>>> say
>>> at most once a minute and during that period they should be  
>>> "static".
>>> I tried a few approches which hasn't really worked out for me so I
>>> wanted to know if somebody has created such a thing or how this  
>>> could
>>> be done. Ideas are also welcome...
>>>
>>> // Daniel Frisk
>>> jalbum.net
>>>
>>> ---------------------------------------------------------------------
>>> 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


Re: Caching of rendered panels

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Don't share component instances across requests / especially sessions.
Don't prematurely optimize.

Cache your model and test the rendering.  If it really is taking too long,
figure out why and worry about it then.

--
Jeremy Thomerson
http://www.wickettraining.com



On Fri, Mar 27, 2009 at 1:12 PM, Martin Grotzke <
martin.grotzke@javakaffee.de> wrote:

> Hi,
>
> I also thought about s.th. like this because we'll have very complex
> component graphs that have to be composed dynamically based on the
> language of the user and ~3 other things. I thought about caching
> complete component instances, but didn't come so far that I thought
> about how this could be integrated into wicket - perhaps dead simple via
> some
>  _cacheService.getReallyComplexComponentCached( "complexComponent",
> userInfo )
>
> I don't know how cheap exactly rendering of our complex component
> structure will be, but if this would take more than say 10 millis we
> would also try to cache already rendered markup.
>
> Cheers,
> Martin
>
>
> On Fri, 2009-03-27 at 16:49 +0100, Daniel Frisk wrote:
> > I have a situation where I have some panels which I want to render say
> > at most once a minute and during that period they should be "static".
> > I tried a few approches which hasn't really worked out for me so I
> > wanted to know if somebody has created such a thing or how this could
> > be done. Ideas are also welcome...
> >
> > // Daniel Frisk
> > jalbum.net
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>

Re: Caching of rendered panels

Posted by Martin Grotzke <ma...@javakaffee.de>.
Hi,

I also thought about s.th. like this because we'll have very complex
component graphs that have to be composed dynamically based on the
language of the user and ~3 other things. I thought about caching
complete component instances, but didn't come so far that I thought
about how this could be integrated into wicket - perhaps dead simple via
some
  _cacheService.getReallyComplexComponentCached( "complexComponent", userInfo )

I don't know how cheap exactly rendering of our complex component
structure will be, but if this would take more than say 10 millis we
would also try to cache already rendered markup.

Cheers,
Martin


On Fri, 2009-03-27 at 16:49 +0100, Daniel Frisk wrote:
> I have a situation where I have some panels which I want to render say  
> at most once a minute and during that period they should be "static".  
> I tried a few approches which hasn't really worked out for me so I  
> wanted to know if somebody has created such a thing or how this could  
> be done. Ideas are also welcome...
> 
> // Daniel Frisk
> jalbum.net
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>