You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Karen Schaper <ka...@gmail.com> on 2009/03/16 00:00:25 UTC

IMarkupCacheKeyProvider - getCacheKey Problem

Hi All,

I have a wicket class that extends from WebPage and implements
        IMarkupResourceStreamProvider,
        IMarkupCacheKeyProvider

I am now using wicket 1.4rc2.


I DO NOT want the markup cached.  The page actually creates a variety of 
markup so it can be different each time.

 From what I've read if the I return null in the method getCacheKey, the 
markup will not be cached.

However when I do this I get into a never ending loop of calls to get 
the markup.

Is this a bug?  Is there any way to not have the markup be cached?

Any thoughts or hints on this would be greatly appreciated.

Thanks

Karen

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


Re: IMarkupCacheKeyProvider - getCacheKey Problem

Posted by flb <la...@gmail.com>.
Hi there!

 I have a question regarding your code below:

@Override
public IResourceStream getMarkupResourceStream( final MarkupContainer
container,   final Class                      containerClass )
 {
           String markup  =   call to method to get the markup string (
creates it on the fly based on some xml )

           return new StringResourceStream( new StringBuffer( markup ) );
 } 

Your markup returned here uses templating with markup inheritance?! 
If so then remove it and use page templating without inheritance! - This was
the solution in my case. I had the same problem as you. 

BR,
Laszlo
-- 
View this message in context: http://www.nabble.com/IMarkupCacheKeyProvider---getCacheKey-Problem-tp22533136p22907105.html
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: IMarkupCacheKeyProvider - getCacheKey Problem

Posted by Johan Compagner <jc...@gmail.com>.
thats the whole point that getMarkupResourceStream is called over and over
again i guess...

Because you dont cache it..

the MarkupCache is called through
MarkupContainer.getAssociatedMarkupStream(final boolean throwException)

and that one is called now and then. So if it is never cached then it will
be called on.

On Mon, Mar 16, 2009 at 15:14, Karen Schaper <ka...@gmail.com>wrote:

> Eelco Hillenius wrote:
>
>> I don't remember the details from the top of my head, but there should
>> be an example at Wicket examples that shows you how to effectively
>> disable caching.
>>
>>
>>
> Yes I found the customresourceloading example and I am doing what it
> says....but it gets into a loop and keeps calling my
>
> "This example loads the custom template just once, though it may reload
> when resource polling is turned on and the template changes. If you want a
> load the template every time a page (or panel) is requested, you can
> additionally let your container implement IMarkupCacheKeyProvider, and then
> return null in the implementation of getCacheKey; Wicket will not cache
> templates without a cache key. This functionality can be used to e.g. when
> you want to load templates from a database, and you know that the actual
> templates can be different from request to request."
>
> Here's is what I am doing....and it doesn't work the call
> getMarkupResourceStream happens over and over and over again....
>
>
> public class QueryDialogPage
>   extends
>       VariationPage
>   implements
>       IMarkupResourceStreamProvider,
>       IMarkupCacheKeyProvider
> {
>     public QueryDialogPage( final PageParameters    parameters )
>   {
>       super( parameters );
>
>       ( method call to add components to page )
>   }
>
>     @Override
>   public IResourceStream getMarkupResourceStream( final MarkupContainer
> container,
>
>       final Class                      containerClass )
>   {
>           String markup  =   call to method to get the markup string (
> creates it on the fly based on some xml )
>
>           return new StringResourceStream( new StringBuffer( markup ) );
>   }
>
>   public String getCacheKey( MarkupContainer container, Class
> containerClass )
>   {
>       return null;
>
>   }
>
>
> }
>
>
>  Eelco
>>
>> On Sun, Mar 15, 2009 at 4:00 PM, Karen Schaper <ka...@gmail.com>
>> wrote:
>>
>>
>>> Hi All,
>>>
>>> I have a wicket class that extends from WebPage and implements
>>>      IMarkupResourceStreamProvider,
>>>      IMarkupCacheKeyProvider
>>>
>>> I am now using wicket 1.4rc2.
>>>
>>>
>>> I DO NOT want the markup cached.  The page actually creates a variety of
>>> markup so it can be different each time.
>>>
>>> From what I've read if the I return null in the method getCacheKey, the
>>> markup will not be cached.
>>>
>>> However when I do this I get into a never ending loop of calls to get the
>>> markup.
>>>
>>> Is this a bug?  Is there any way to not have the markup be cached?
>>>
>>> Any thoughts or hints on this would be greatly appreciated.
>>>
>>> Thanks
>>>
>>> Karen
>>>
>>> ---------------------------------------------------------------------
>>> 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: IMarkupCacheKeyProvider - getCacheKey Problem

Posted by Igor Vaynberg <ig...@gmail.com>.
open a jira and provide a quickstart

-igor

On Mon, Mar 16, 2009 at 7:14 AM, Karen Schaper <ka...@gmail.com> wrote:
> Eelco Hillenius wrote:
>>
>> I don't remember the details from the top of my head, but there should
>> be an example at Wicket examples that shows you how to effectively
>> disable caching.
>>
>>
>
> Yes I found the customresourceloading example and I am doing what it
> says....but it gets into a loop and keeps calling my
>
> "This example loads the custom template just once, though it may reload when
> resource polling is turned on and the template changes. If you want a load
> the template every time a page (or panel) is requested, you can additionally
> let your container implement IMarkupCacheKeyProvider, and then return null
> in the implementation of getCacheKey; Wicket will not cache templates
> without a cache key. This functionality can be used to e.g. when you want to
> load templates from a database, and you know that the actual templates can
> be different from request to request."
>
> Here's is what I am doing....and it doesn't work the call
> getMarkupResourceStream happens over and over and over again....
>
>
> public class QueryDialogPage
>   extends
>       VariationPage
>   implements
>       IMarkupResourceStreamProvider,
>       IMarkupCacheKeyProvider
> {
>     public QueryDialogPage( final PageParameters    parameters )
>   {
>       super( parameters );
>
>       ( method call to add components to page )
>   }
>
>     @Override
>   public IResourceStream getMarkupResourceStream( final MarkupContainer
> container,
>
>       final Class                      containerClass )
>   {
>           String markup  =   call to method to get the markup string (
> creates it on the fly based on some xml )
>
>           return new StringResourceStream( new StringBuffer( markup ) );
>   }
>
>   public String getCacheKey( MarkupContainer container, Class containerClass
> )
>   {
>       return null;
>   }
>
>
> }
>
>
>> Eelco
>>
>> On Sun, Mar 15, 2009 at 4:00 PM, Karen Schaper <ka...@gmail.com>
>> wrote:
>>
>>>
>>> Hi All,
>>>
>>> I have a wicket class that extends from WebPage and implements
>>>      IMarkupResourceStreamProvider,
>>>      IMarkupCacheKeyProvider
>>>
>>> I am now using wicket 1.4rc2.
>>>
>>>
>>> I DO NOT want the markup cached.  The page actually creates a variety of
>>> markup so it can be different each time.
>>>
>>> From what I've read if the I return null in the method getCacheKey, the
>>> markup will not be cached.
>>>
>>> However when I do this I get into a never ending loop of calls to get the
>>> markup.
>>>
>>> Is this a bug?  Is there any way to not have the markup be cached?
>>>
>>> Any thoughts or hints on this would be greatly appreciated.
>>>
>>> Thanks
>>>
>>> Karen
>>>
>>> ---------------------------------------------------------------------
>>> 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: IMarkupCacheKeyProvider - getCacheKey Problem

Posted by Karen Schaper <ka...@gmail.com>.
Eelco Hillenius wrote:
> I don't remember the details from the top of my head, but there should
> be an example at Wicket examples that shows you how to effectively
> disable caching.
>
>   
Yes I found the customresourceloading example and I am doing what it 
says....but it gets into a loop and keeps calling my

"This example loads the custom template just once, though it may reload 
when resource polling is turned on and the template changes. If you want 
a load the template every time a page (or panel) is requested, you can 
additionally let your container implement IMarkupCacheKeyProvider, and 
then return null in the implementation of getCacheKey; Wicket will not 
cache templates without a cache key. This functionality can be used to 
e.g. when you want to load templates from a database, and you know that 
the actual templates can be different from request to request."

Here's is what I am doing....and it doesn't work the call 
getMarkupResourceStream happens over and over and over again....


public class QueryDialogPage
    extends
        VariationPage
    implements
        IMarkupResourceStreamProvider,
        IMarkupCacheKeyProvider
{
  
    public QueryDialogPage( final PageParameters    parameters )
    {
        super( parameters );

        ( method call to add components to page )
    }

   
    @Override
    public IResourceStream getMarkupResourceStream( final 
MarkupContainer   container,
                                                                        
              final Class                      containerClass )
    {
            String markup  =   call to method to get the markup string ( 
creates it on the fly based on some xml )

            return new StringResourceStream( new StringBuffer( markup ) );
    }
   

    public String getCacheKey( MarkupContainer container, Class 
containerClass )
    {
        return null;
    }


}


> Eelco
>
> On Sun, Mar 15, 2009 at 4:00 PM, Karen Schaper <ka...@gmail.com> wrote:
>   
>> Hi All,
>>
>> I have a wicket class that extends from WebPage and implements
>>       IMarkupResourceStreamProvider,
>>       IMarkupCacheKeyProvider
>>
>> I am now using wicket 1.4rc2.
>>
>>
>> I DO NOT want the markup cached.  The page actually creates a variety of
>> markup so it can be different each time.
>>
>> From what I've read if the I return null in the method getCacheKey, the
>> markup will not be cached.
>>
>> However when I do this I get into a never ending loop of calls to get the
>> markup.
>>
>> Is this a bug?  Is there any way to not have the markup be cached?
>>
>> Any thoughts or hints on this would be greatly appreciated.
>>
>> Thanks
>>
>> Karen
>>
>> ---------------------------------------------------------------------
>> 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: IMarkupCacheKeyProvider - getCacheKey Problem

Posted by Eelco Hillenius <ee...@gmail.com>.
I don't remember the details from the top of my head, but there should
be an example at Wicket examples that shows you how to effectively
disable caching.

Eelco

On Sun, Mar 15, 2009 at 4:00 PM, Karen Schaper <ka...@gmail.com> wrote:
> Hi All,
>
> I have a wicket class that extends from WebPage and implements
>       IMarkupResourceStreamProvider,
>       IMarkupCacheKeyProvider
>
> I am now using wicket 1.4rc2.
>
>
> I DO NOT want the markup cached.  The page actually creates a variety of
> markup so it can be different each time.
>
> From what I've read if the I return null in the method getCacheKey, the
> markup will not be cached.
>
> However when I do this I get into a never ending loop of calls to get the
> markup.
>
> Is this a bug?  Is there any way to not have the markup be cached?
>
> Any thoughts or hints on this would be greatly appreciated.
>
> Thanks
>
> Karen
>
> ---------------------------------------------------------------------
> 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