Po Ki Chui | 30 Sep 15:47

Cache URL with parameters

Hi all,

I wonder if Magnolia EE 3.5.8 is capable to cache URL with parameters  
(i.e. http://example.com/index.html?param=test). Your answer is  
appreciated.

Thanks,
Po Ki

----------------------------------------------------------------
Matteo Pelucco | 30 Sep 15:56

Re: Cache URL with parameters

Po Ki Chui ha scritto:
> Hi all,
> 
> I wonder if Magnolia EE 3.5.8 is capable to cache URL with parameters 
> (i.e. http://example.com/index.html?param=test). Your answer is 
> appreciated.

Of course...
You can read parameters like any JSP pages.

http://example.com/index.html?param=test

<%= request.getParameter("param") %>

I don't exactly know if Magnolia already provide some API to read 
parameters as well... anyway, look at the javadoc :-)

Matteo

> 
> 
> Thanks,
> Po Ki
> 
> ----------------------------------------------------------------

----------------------------------------------------------------
Tom Wespi | 30 Sep 16:00

Re: Cache URL with parameters

Hi

that is not possible, but you can use selectors (/index.test.html) or  
Virtual Uri Mapping (/index/param/test). Both methods are cacheable.

Tom

On 30.09.2008, at 15:51, Po Ki Chui wrote:

> Hi all,
>
> I wonder if Magnolia EE 3.5.8 is capable to cache URL with  
> parameters (i.e. http://example.com/index.html?param=test). Your  
> answer is appreciated.
>
>
> Thanks,
> Po Ki
>
> ----------------------------------------------------------------
> for list details see
> http://documentation.magnolia.info/
> ----------------------------------------------------------------

----------------------------------------------------------------
Po Ki Chui | 30 Sep 16:04

Re: Cache URL with parameters

Sorry, I may not be clear.

Magnolia has the ehcache capability. However, we could only get URLs  
without parameters to work with ehcache (i.e. http://example.com/ 
index.html). Any URLs with parameters (i.e. http://example.com/ 
index.html?param=test) are not cached. I wonder if there is a way to  
cache it.

Thanks,
Po Ki

On Sep 30, 2008, at 9:59 AM, Matteo Pelucco wrote:

> Po Ki Chui ha scritto:
>> Hi all,
>> I wonder if Magnolia EE 3.5.8 is capable to cache URL with  
>> parameters (i.e. http://example.com/index.html?param=test). Your  
>> answer is appreciated.
>
> Of course...
> You can read parameters like any JSP pages.
>
> http://example.com/index.html?param=test
>
> <%= request.getParameter("param") %>
>
> I don't exactly know if Magnolia already provide some API to read  
> parameters as well... anyway, look at the javadoc :-)
>
> Matteo
(Continue reading)

Giancarlo F. Berner | 30 Sep 16:26

Re: Cache URL with parameters

Hi Po Ki

I am not quite sure if you want to cache URL with parameters in the  
first place. Typically the "?" is used to pass caching in Web servers.  
Simplified: requests with a "GET" method and parameters are NOT  
answered from a cache.
I personally would go with this de facto standard and use "?" for not  
getting a cached response.

If you want to cache parameters, I use the "selectors". A selector is  
a "dot separated value between URI label and extension". For example,  
your request could look like
http://example.com/index.test.html, where "test" is the selector. The  
response of this URL will be cached. You can of course use multiple  
selectors (e.g. /page.test1.test2.html).

Use "Resource.getSelector()" to get a String of all selectors.

/giancarlo

On Sep 30, 2008, at 6:51 AM, Po Ki Chui wrote:

> Hi all,
>
> I wonder if Magnolia EE 3.5.8 is capable to cache URL with  
> parameters (i.e. http://example.com/index.html?param=test). Your  
> answer is appreciated.
>
>
> Thanks,
(Continue reading)

Po Ki Chui | 30 Sep 16:34

Re: Cache URL with parameters

Thanks for everyone's replies! Thank you all so much! I'd definitely  
look into selectors and virtual URI mapping to solve our issues.

Thanks again,
Po Ki

On Sep 30, 2008, at 10:26 AM, Giancarlo F. Berner wrote:

> Hi Po Ki
>
> I am not quite sure if you want to cache URL with parameters in the  
> first place. Typically the "?" is used to pass caching in Web  
> servers. Simplified: requests with a "GET" method and parameters  
> are NOT answered from a cache.
> I personally would go with this de facto standard and use "?" for  
> not getting a cached response.
>
> If you want to cache parameters, I use the "selectors". A selector  
> is a "dot separated value between URI label and extension". For  
> example, your request could look like
> http://example.com/index.test.html, where "test" is the selector.  
> The response of this URL will be cached. You can of course use  
> multiple selectors (e.g. /page.test1.test2.html).
>
> Use "Resource.getSelector()" to get a String of all selectors.
>
> /giancarlo
>
>
> On Sep 30, 2008, at 6:51 AM, Po Ki Chui wrote:
(Continue reading)

Jan Haderka | 30 Sep 16:38

Re: Cache URL with parameters

Hi Po Ki,
while the others talked more about possible workarounds for situation
when you are not caching requests with parameters, here is the answer to
the question itself:

Magnolia 3.5.8 - NO you cannot cache requests with parameters

Magnolia 3.6 - YES you can cache requests with parameters.

The feature is not enabled by default since most parametrized requests
are truly not cachable, but if you have some that you know should be
cached you can make then cachable by changing voter configuration of
Default CachingPolicy or by implementing your own CachingPolicy
completely for more complex scenarios.
Hope this helps,

Regards,
Jan

On Tue, 2008-09-30 at 09:51 -0400, Po Ki Chui wrote:
> Hi all,
> 
> I wonder if Magnolia EE 3.5.8 is capable to cache URL with parameters  
> (i.e. http://example.com/index.html?param=test). Your answer is  
> appreciated.
> 
> 
> Thanks,
> Po Ki
> 
(Continue reading)

Will Scheidegger | 30 Sep 16:43

Re: Cache URL with parameters

See "Configuration" > /modules/cache/config/... for details. The  
configuration of the cache can be tricky - There is _some_  
documentation here:
http://documentation.magnolia.info/modules/cache.html

Cheers,
Will

On 30.09.2008, at 16:42, Jan Haderka wrote:

> Hi Po Ki,
> while the others talked more about possible workarounds for situation
> when you are not caching requests with parameters, here is the  
> answer to
> the question itself:
>
> Magnolia 3.5.8 - NO you cannot cache requests with parameters
>
> Magnolia 3.6 - YES you can cache requests with parameters.
>
> The feature is not enabled by default since most parametrized requests
> are truly not cachable, but if you have some that you know should be
> cached you can make then cachable by changing voter configuration of
> Default CachingPolicy or by implementing your own CachingPolicy
> completely for more complex scenarios.
> Hope this helps,
>
> Regards,
> Jan
>
(Continue reading)

Jan Haderka | 30 Sep 16:56

Re: Cache URL with parameters

On Tue, 2008-09-30 at 16:46 +0200, Will Scheidegger wrote:
> See "Configuration" > /modules/cache/config/... for details. The  
> configuration of the cache can be tricky - There is _some_ 

Sounds like you had troubles following the docu. If so, care to share
what was unclear or missing so we can improve it? (There is a
Documentation project in jira ;) )

>  
> documentation here:
> http://documentation.magnolia.info/modules/cache.html

Thanks for providing the link. I guess I should have done so when
writing my response.

Cheers,
Jan

----------------------------------------------------------------
Will Scheidegger | 30 Sep 17:00

Re: Cache URL with parameters

I will start a new approach to the "cache" subject when 3.6.2 is out.

The troubles we had might have had their origin in the fact that we  
tried things with an RC3 of M 3.6 - easily possible that some things  
were still buggy back then. We ended up turning of the cache filter.  
This made us trip into the cache/gzip bug in 3.6.1. Therefore I'm  
eagerly waiting for 3.6.2 to start over again. :-)

I'll be happy to contribute our experiences...

Cheers,
Will

On 30.09.2008, at 16:56, Jan Haderka wrote:

> On Tue, 2008-09-30 at 16:46 +0200, Will Scheidegger wrote:
>> See "Configuration" > /modules/cache/config/... for details. The
>> configuration of the cache can be tricky - There is _some_
>
> Sounds like you had troubles following the docu. If so, care to share
> what was unclear or missing so we can improve it? (There is a
> Documentation project in jira ;) )
>
>>
>> documentation here:
>> http://documentation.magnolia.info/modules/cache.html
>
> Thanks for providing the link. I guess I should have done so when
> writing my response.
>
(Continue reading)


Gmane