![]() |
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? |
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. |
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. |
Maybe memcached + lsws + integration in APP
|
Quote:
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. |
Quote:
|
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?
|
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.
|
|
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! |
| All times are GMT -7. The time now is 08:20 PM. |