You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Joe Toth <jo...@gmail.com> on 2007/10/24 00:41:04 UTC

Cache Panel

I have a bunch of Panels where the generated HTML can be cached for a
period of time. 

What's the best way to go about doing something like this?

Thanks!


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


Re: Cache Panel

Posted by Joe Toth <jo...@gmail.com>.
No, sorry should of specified, the output generated from a component.


On Wed, 2007-10-24 at 08:25 -0700, Igor Vaynberg wrote:
> you are talking about the markup for an actual component? you store
> that in the database?
> 
> in that case let your component implement imarkupcachekeyprovider that
> generates different keys based on some timeout or whatever it is you
> need.
> 
> -igor
> 
> 
> On 10/24/07, Joe Toth <jo...@gmail.com> wrote:
> > How would I render the component and stick the contents into a label?
> >
> > If possible, I would like to do something like the following...
> >
> > String render() {
> >
> >     String markup = cache.get();
> >     if (cacheExpired || markup == null) {
> >        markup = render();
> >     }
> >
> >     return markup;
> > }
> >
> > I know there is no "String render()" method, but this just shows what I
> > would like to accomplish.
> >
> > Thanks!
> >
> >
> > On Tue, 2007-10-23 at 20:00 -0700, Igor Vaynberg wrote:
> > > use any cache you want to cache it, and stick the contents into a label
> > >
> > > -igor
> > >
> > >
> > > On 10/23/07, Joe Toth <jo...@gmail.com> wrote:
> > > > There are some operations that are kind of complicated, rather than dig
> > > > into those operations and try to cache things, it would be A LOT easier
> > > > to just stick a cache in front of it all.
> > > >
> > > >
> > > >
> > > > On Tue, 2007-10-23 at 21:01 -0500, Jeremy Thomerson wrote:
> > > > > The first thing to ask yourself would be if you really need to do that.
> > > > > HTML generation is extremely fast, and generally does not need to be
> > > > > cached.  If page generation is taking a long time, it is likely that DB
> > > > > operations or external service operations are what needs to be cached.
> > > > >
> > > > > Was there a particular reason you had in mind for caching the HTML?
> > > > >
> > > > > Jeremy Thomerson
> > > > >
> > > > > On 10/23/07, Joe Toth <jo...@gmail.com> wrote:
> > > > > >
> > > > > > I have a bunch of Panels where the generated HTML can be cached for a
> > > > > > period of time.
> > > > > >
> > > > > > What's the best way to go about doing something like this?
> > > > > >
> > > > > > Thanks!
> > > > > >
> > > > > >
> > > > > > ---------------------------------------------------------------------
> > > > > > 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: Cache Panel

Posted by Igor Vaynberg <ig...@gmail.com>.
you are talking about the markup for an actual component? you store
that in the database?

in that case let your component implement imarkupcachekeyprovider that
generates different keys based on some timeout or whatever it is you
need.

-igor


On 10/24/07, Joe Toth <jo...@gmail.com> wrote:
> How would I render the component and stick the contents into a label?
>
> If possible, I would like to do something like the following...
>
> String render() {
>
>     String markup = cache.get();
>     if (cacheExpired || markup == null) {
>        markup = render();
>     }
>
>     return markup;
> }
>
> I know there is no "String render()" method, but this just shows what I
> would like to accomplish.
>
> Thanks!
>
>
> On Tue, 2007-10-23 at 20:00 -0700, Igor Vaynberg wrote:
> > use any cache you want to cache it, and stick the contents into a label
> >
> > -igor
> >
> >
> > On 10/23/07, Joe Toth <jo...@gmail.com> wrote:
> > > There are some operations that are kind of complicated, rather than dig
> > > into those operations and try to cache things, it would be A LOT easier
> > > to just stick a cache in front of it all.
> > >
> > >
> > >
> > > On Tue, 2007-10-23 at 21:01 -0500, Jeremy Thomerson wrote:
> > > > The first thing to ask yourself would be if you really need to do that.
> > > > HTML generation is extremely fast, and generally does not need to be
> > > > cached.  If page generation is taking a long time, it is likely that DB
> > > > operations or external service operations are what needs to be cached.
> > > >
> > > > Was there a particular reason you had in mind for caching the HTML?
> > > >
> > > > Jeremy Thomerson
> > > >
> > > > On 10/23/07, Joe Toth <jo...@gmail.com> wrote:
> > > > >
> > > > > I have a bunch of Panels where the generated HTML can be cached for a
> > > > > period of time.
> > > > >
> > > > > What's the best way to go about doing something like this?
> > > > >
> > > > > Thanks!
> > > > >
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > 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: Cache Panel

Posted by Joe Toth <jo...@gmail.com>.
How would I render the component and stick the contents into a label?

If possible, I would like to do something like the following...

String render() {

    String markup = cache.get();
    if (cacheExpired || markup == null) {
       markup = render();
    }

    return markup;
}

I know there is no "String render()" method, but this just shows what I
would like to accomplish.

Thanks!


On Tue, 2007-10-23 at 20:00 -0700, Igor Vaynberg wrote:
> use any cache you want to cache it, and stick the contents into a label
> 
> -igor
> 
> 
> On 10/23/07, Joe Toth <jo...@gmail.com> wrote:
> > There are some operations that are kind of complicated, rather than dig
> > into those operations and try to cache things, it would be A LOT easier
> > to just stick a cache in front of it all.
> >
> >
> >
> > On Tue, 2007-10-23 at 21:01 -0500, Jeremy Thomerson wrote:
> > > The first thing to ask yourself would be if you really need to do that.
> > > HTML generation is extremely fast, and generally does not need to be
> > > cached.  If page generation is taking a long time, it is likely that DB
> > > operations or external service operations are what needs to be cached.
> > >
> > > Was there a particular reason you had in mind for caching the HTML?
> > >
> > > Jeremy Thomerson
> > >
> > > On 10/23/07, Joe Toth <jo...@gmail.com> wrote:
> > > >
> > > > I have a bunch of Panels where the generated HTML can be cached for a
> > > > period of time.
> > > >
> > > > What's the best way to go about doing something like this?
> > > >
> > > > Thanks!
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > 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: Cache Panel

Posted by Igor Vaynberg <ig...@gmail.com>.
use any cache you want to cache it, and stick the contents into a label

-igor


On 10/23/07, Joe Toth <jo...@gmail.com> wrote:
> There are some operations that are kind of complicated, rather than dig
> into those operations and try to cache things, it would be A LOT easier
> to just stick a cache in front of it all.
>
>
>
> On Tue, 2007-10-23 at 21:01 -0500, Jeremy Thomerson wrote:
> > The first thing to ask yourself would be if you really need to do that.
> > HTML generation is extremely fast, and generally does not need to be
> > cached.  If page generation is taking a long time, it is likely that DB
> > operations or external service operations are what needs to be cached.
> >
> > Was there a particular reason you had in mind for caching the HTML?
> >
> > Jeremy Thomerson
> >
> > On 10/23/07, Joe Toth <jo...@gmail.com> wrote:
> > >
> > > I have a bunch of Panels where the generated HTML can be cached for a
> > > period of time.
> > >
> > > What's the best way to go about doing something like this?
> > >
> > > Thanks!
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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: Cache Panel

Posted by Joe Toth <jo...@gmail.com>.
There are some operations that are kind of complicated, rather than dig
into those operations and try to cache things, it would be A LOT easier
to just stick a cache in front of it all.



On Tue, 2007-10-23 at 21:01 -0500, Jeremy Thomerson wrote:
> The first thing to ask yourself would be if you really need to do that.
> HTML generation is extremely fast, and generally does not need to be
> cached.  If page generation is taking a long time, it is likely that DB
> operations or external service operations are what needs to be cached.
> 
> Was there a particular reason you had in mind for caching the HTML?
> 
> Jeremy Thomerson
> 
> On 10/23/07, Joe Toth <jo...@gmail.com> wrote:
> >
> > I have a bunch of Panels where the generated HTML can be cached for a
> > period of time.
> >
> > What's the best way to go about doing something like this?
> >
> > Thanks!
> >
> >
> > ---------------------------------------------------------------------
> > 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: Cache Panel

Posted by Jeremy Thomerson <je...@thomersonfamily.com>.
The first thing to ask yourself would be if you really need to do that.
HTML generation is extremely fast, and generally does not need to be
cached.  If page generation is taking a long time, it is likely that DB
operations or external service operations are what needs to be cached.

Was there a particular reason you had in mind for caching the HTML?

Jeremy Thomerson

On 10/23/07, Joe Toth <jo...@gmail.com> wrote:
>
> I have a bunch of Panels where the generated HTML can be cached for a
> period of time.
>
> What's the best way to go about doing something like this?
>
> Thanks!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>