LiteSpeed Support Forums

LiteSpeed Support Forums (http://www.litespeedtech.com/support/forum/index.php)
-   LiteSpeed Cache (http://www.litespeedtech.com/support/forum/forumdisplay.php?f=30)
-   -   Private cache max-age ? (http://www.litespeedtech.com/support/forum/showthread.php?t=6651)

Monarobase 02-10-2013 02:08 AM

Private cache max-age ?
 
Hello,

Your wiki says to use E=Cache-Control:max-age=60 for 60 seconds public cache and E=Cache-Control:private for private cache.

Both of these work with .htaccess and mod_rewrite rules

Can I set the max-age for private cache in htacess files ?

Or can users only use the server global defined private cache max-age value ?

Thanks

NiteWave 02-12-2013 12:15 AM

Quote:

Can I set the max-age for private cache in htacess files ?
yes. just tested and confirm it works.

Monarobase 02-12-2013 12:25 AM

Thanks,

How would I do this ? All my tries failed…

NiteWave 02-12-2013 12:29 AM

for example, in .htaccess,
Code:

RewriteRule \.php - [E=Cache-Control:private,E=Cache-Control:max-age=300]
or
Code:

RewriteRule \.php - [E=Cache-Control:private]
RewriteRule \.php - [E=Cache-Control:max-age=300]


Monarobase 02-12-2013 01:03 AM

Thanks,

I was under the impression that those lines would first set the envrionement variable to private and then replace the private setting by max-age=300 thus being the equivalent of only max-age=300…

With Apache's mod_cache, Cache-Control should be set to :

"max-age=300, private"

Monarobase 02-12-2013 01:32 AM

I've just tested :

RewriteRule \.php - [E=Cache-Control:private,E=Cache-Control:max-age=300]
Code:

X-LiteSpeed-Cache : hit

RewriteRule \.php - [E=Cache-Control:private]
Code:

X-LiteSpeed-Cache : hit,private

NiteWave 02-12-2013 02:22 AM

hmm ... I'd like to reproduce your result, to find out possible bugs.

what's the cache policy you set ? and any other rewrite rules ?

I did tests only for this simple php:
PHP Code:

/usr/local/lsws/DEFAULT/html>cat r.php
<?php
echo date("c");
echo 
"\n";
?>


Monarobase 02-12-2013 02:42 AM

Hello,

My .htaccess file :

Code:

RewriteEngine On

RewriteRule \.php - [E=Cache-Control:private,E=Cache-Control:max-age=300]
#end of file

I used your r.php script

Cache-Crontrol is an environement variable, if you set it twice it's normal that the second value replaces the first.

You need to be able to set both values seperated by a comma. However I havn't found the correct syntax to do this :

I've tried without success things like this :
Code:

RewriteRule \.php - [E=Cache-Control:'private, max-age=180']
But it gives an error in ls logs:
Code:

ERROR        [[HTAccess]] rewrite: Unknown rewrite rule flag while parsing: RewriteRule \.php - [E=Cache-Control:'private, max-age=180']
My cache is set to :

Code:

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

Thanks

NiteWave 02-12-2013 03:00 AM

my test result always:
Code:

X-LiteSpeed-Cache: hit,private
here's one of result:
Code:

~>curl -i 127.0.0.1/r.php
HTTP/1.1 200 OK
Date: Tue, 12 Feb 2013 10:55:17 GMT
Server: LiteSpeed/4.2.2 Enterprise
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
X-LiteSpeed-Cache: hit,private
Content-Length: 26
X-Powered-By: PHP/5.3.10
Content-Type: text/html

2013-02-12T18:55:14+08:00

I'm testing with lsws 4.2.2

Monarobase 02-12-2013 03:09 AM

Quote:

~ curl -i http://test.tld/r.php
HTTP/1.1 200 OK
Date: Tue, 12 Feb 2013 11:03:35 GMT
Server: LiteSpeed
X-LiteSpeed-Cache: hit
Content-Length: 26
Content-Type: text/html; charset=UTF-8
Connection: close

2013-02-12T12:03:34+01:00
I haven't upgraded to LiteSpeed/4.2.2 Enterprise yet (I'm running 4.2.1).

Is 4.2.2 in Release ?

In my WHM interface it says :

Latest Release: 4.2.1

I prefer to wait untill version 4.2.2 shows as an available update in the WHM interface unless the update feature doesn't work and will never show the next version ?


All times are GMT -7. The time now is 04:59 PM.