LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > LiteSpeed Cache > Content-Aware Caching

Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2010, 10:48 AM
J.T. J.T. is offline
Member
 
Join Date: Apr 2010
Posts: 47
Default Content-Aware Caching

Hi,

I'm looking at options to save cached versions of otherwise dynamically created pages, but only to those requests that make sense.

It's for an online shop so once a product is added to the basket for example, we need to stop caching. We also show "recently viewed products" in a sidebar, so once stuff like that is populated, we need to switch back to dynamic.

In other words, for search engine crawlers and first time visitors, I want blazing fast load times. Subsequent page loads can be dynamic.

LSWS's caching seems limited by headers and not aware of the contents of the request. It's nice to say don't cache if a cookie is involved, but better would be if the cookie contains "cache=0". Like varnish for example, it would be great if it could look inside the content, be content-aware.

Same with query string matching. We can say don't cache if there's a query string. Better would be if we can say don't cache if there's a query string saying cache=0. It would make LSWS caching a lot more flexible and powerful.

The e-commerce engine creates a cookie on the first load and almost all pages use query strings. I don't have enough clever data to match caching policies against.

Session based policies would be great too.

Is this on the roadmap already?
Reply With Quote
  #2  
Old 07-29-2010, 12:00 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
You can make caching more flexible like you described with Rewrite Rules by setting environment "Cache-ctrl", like

RewriteCond ${QUERY_STRING} cache=0
RewriteRule .* - [E=Cache-control:no-cache]

You can use regular Cache-Control directives.
Reply With Quote
  #3  
Old 07-30-2010, 03:42 AM
J.T. J.T. is offline
Member
 
Join Date: Apr 2010
Posts: 47
But that controls the browser cache, doesn't it?

I mean serving a static HTML copy of otherwise dynamic content, so we save opcoding and DB querying those pages before sending the HTML to the browser. Like Squid/Varnish or reverse proxies etc. I believe Litespeed Load Balancer offers it too if I read the feature list correctly.

For a first time visitor, even if I set the cache-control headers, then it still only comes into effect on the second page load. I want it so that Litespeed serves a static copy to those.

Basically, I want this but without Varnish, and with LSWS:

http://www.kalenyuk.com.ua/magento-p...-cache-47.html

Based on the user's history/actions, it knows when to set cookies/headers/query strings telling Varnish to show from cache or not to show from cache.
Reply With Quote
  #4  
Old 07-30-2010, 05:50 AM
meto meto is offline
Senior Member
 
Join Date: Jan 2008
Posts: 65
Maybe memcached + lsws + integration in APP
Reply With Quote
  #5  
Old 07-30-2010, 11:15 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
Quote:
But that controls the browser cache, doesn't it?
No, it control the server cache behavior.

You can configure LSWS to use cached page by default, and turn off cache with rewrite rule when a page should not be cached.

Maybe it is not exactly what you want, I think we probably need to add a special "Cache-control" directive to tell LSWS when to update a cached page with new content.
Reply With Quote
  #6  
Old 09-17-2010, 03:59 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
Quote:
RewriteRule index.php - [E=Cache-control:max-age=15]
to cache index.php for 15 seconds
Reply With Quote
  #7  
Old 09-27-2010, 12:47 AM
PSS PSS is offline
Senior Member
 
Join Date: Jun 2007
Posts: 126
Where is the manual/FAQ for cache? Specifically: what it exactly does/help with dynamic (php) documents and how, and how to tune it based on what you serve?
Reply With Quote
  #8  
Old 01-05-2011, 08:09 AM
J.T. J.T. is offline
Member
 
Join Date: Apr 2010
Posts: 47
I will be revisiting our options in this department again and like PSS, also wonder where best to go for documentation. As we have both a VPS and an Enterprise license, it would be nice to have access to detailed documentation on exactly how to accomplish this.
Reply With Quote
  #9  
Old 01-05-2011, 12:19 PM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,337
https://store.litespeedtech.com/stor...yarticle&id=21
Reply With Quote
  #10  
Old 01-07-2011, 10:20 AM
J.T. J.T. is offline
Member
 
Join Date: Apr 2010
Posts: 47
Thanks. So it seems like for this purpose it's pretty much limited to query string, effectively. Can't look in cookies or sessions with this so the e-commerce system needs to add a url parameter if it doesn't want LSWS to use a cached page to a specific visitor.

That's a start but doesn't give many options. I can make it work for a very small subset of pages.

Ideally, like Zend Server, we can add session parameters as part of the condition, see condition two in this example:

http://files.zend.com/help/Zend-Serv...ge_caching.htm

That way, we can show a dynamic page to logged in users, to those who have added stuff to their cart etc. And show a static page to those who haven't done anything yet that personalises the page. I put that on my X-Mas wish list... For 2010 Please!

Last edited by J.T.; 01-07-2011 at 10:24 AM..
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:22 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.