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

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > LiteSpeed Cache > How do i test if cache is working

Reply
 
Thread Tools Display Modes
  #1  
Old 02-14-2013, 03:00 AM
Ledgemonkey Ledgemonkey is offline
Member
 
Join Date: Feb 2013
Posts: 11
Question How do i test if cache is working

what does this mean and how do you use it...?

7. Verify if pages are served from LSWS cache

Since 4.0.19 release, LiteSpeed outputs a response header “X-LiteSpeed-Cache: hit” if a request is served from cache.

Since 4.1.1 release, LiteSpeed outputs a response header “X-LiteSpeed-Cache: hit,private” if a request is served from private cache.
Reply With Quote
  #2  
Old 02-14-2013, 10:33 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,338
A server response has headers. You can look at via firebug or run command line like 'curl -I http://example.com/path/to/resource'
Quote:
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:10108
Content-Type:text/html
Date:Thu, 14 Feb 2013 18:31:00 GMT
Keep-Alive:timeout=5, max=100
Server:LiteSpeed
Vary:Accept-Encoding
X-Litespeed-Cache:hit
X-Powered-By:PHP/5.3.20
A response served from LS cache carries 'X-LiteSpeed-Cache' header as shown above
Reply With Quote
  #3  
Old 02-15-2013, 05:35 AM
Ledgemonkey Ledgemonkey is offline
Member
 
Join Date: Feb 2013
Posts: 11
Question testing cache

Thanks for the reply:

I have this in htttp.conf:

LoadModule cache_module modules/mod_cache.so
<IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
CacheRoot /tmp/diskcache/
CacheEnable disk /
</IfModule>
</IfModule>

I have files in tmp/diskcache/ 0/ 1/ 2/ 3/ a/ b/ c/ d/ e/ etc.

my LS cache settings are :

Storage Path:tmp/diskcache
Max Object Size: 128K

Cache Policy
Enable Cache: No
Cache Expire Time (seconds): Not Set
Cache Request with Query String: No
Cache Request with Cookie: No
Cache Response with Cookie: No
Ignore Request Cache-Control: No
Ignore Response Cache-Control: No
Enable Private Cache: Yes
Private Cache Expire Time (seconds): 120

I have this in my Magento .htaccess (which is not in root directory)

RewriteEngine on
RewriteRule cacheable/(.*\.php)?$ - [L,E=cache-control:max-age=120]

Getting this from response header..?
HTTP/1.1 200 OK
Date: Fri, 15 Feb 2013 13:27:44 GMT
Server: LiteSpeed
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
X-Powered-By: PHP/5.3.21
Set-Cookie: frontend=72ed1ce898e1dec005b44904ba6abc6a; expires=Fri, 15-Feb-2013 14:27:42 GMT; path=/; domain=www.staging.shushushops.co.uk; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache

Content-Type: text/html; charset=UTF-8
Vary: User-Agent
Vary: User-Agent

Any ideas where I'm going wrong...?

Many thanks...
Reply With Quote
  #4  
Old 02-15-2013, 09:21 AM
Ledgemonkey Ledgemonkey is offline
Member
 
Join Date: Feb 2013
Posts: 11
Question cache testing update

I changed the Rewrite to:

RewriteEngine on
RewriteRule (.*\.php)?$ - [L,E=Cache-Control:max-age=120]

And tested using curl -I - X-Litespeed-Cache:hit was in the response , but testing again and has stopped showing up.

Can't be far away...!

Have tried different rules but not working...?

Any ideas...?

Thanks
Reply With Quote
  #5  
Old 02-15-2013, 10:29 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,338
in cache policy, set ignore request/response cache-control header to yes.
Reply With Quote
  #6  
Old 02-16-2013, 04:59 AM
Ledgemonkey Ledgemonkey is offline
Member
 
Join Date: Feb 2013
Posts: 11
Thumbs up now getting X-LiteSpeed-Cache: hit response

Hi,

Now getting the X-LiteSpeed-Cache: hit response....

Just need to get the rewrite rules correct so I don't cache the admin pages..in magento backend..
Reply With Quote
  #7  
Old 02-16-2013, 10:09 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,338
you can put the admin page url in the 'Do-Not-Cache URL' box. mouse over the 'i' pop-up window for more information.
Reply With Quote
  #8  
Old 02-18-2013, 01:50 AM
Ledgemonkey Ledgemonkey is offline
Member
 
Join Date: Feb 2013
Posts: 11
Quote:
Originally Posted by webizen View Post
you can put the admin page url in the 'Do-Not-Cache URL' box. mouse over the 'i' pop-up window for more information.
Can't seem to exclude the Magento admin area from cache , I've tried various settings in the 'Do-Not-Cache URL' box and in the .htaccess file but cant seem to be able to make it work.

Any idea what the correct code could be in the .htaccess file to exclude all urls which contain "admin"..?

Thanks
Reply With Quote
  #9  
Old 02-18-2013, 10:04 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,338
you can refer to this wiki for 'Do-Not-Cache URL' settings

http://www.litespeedtech.com/support...:cache:magento
Reply With Quote
  #10  
Old 02-22-2013, 06:11 AM
Ledgemonkey Ledgemonkey is offline
Member
 
Join Date: Feb 2013
Posts: 11
doesn't work tried all sorts...?

What re-write rules should i use in htaccess ?

If I use this RewriteRule (.*\.php)?$ - [L,E=Cache-Control:max-age=120] my pages break with Use Web Server Rewrites set to "yes" in amgento backend.

Thanks
Reply With Quote
Reply

Tags
cache, testing

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 12:55 PM.



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