You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Campbell, Lance" <la...@uiuc.edu> on 2008/01/07 06:59:12 UTC

[users@httpd] mod_disk_cache

httpd-2.0.59

 

Does mod_disk_cache support a mechanism that one can request a
particular URL to have its content refreshed?

 

I know you can delete the entire disk cache root and it will then
refresh the content.  But is there a way to just request that a
particular URL be refreshed within the cached content?

 

I thought I would create multiple disk caches and then delete the cached
files in the disk cache I wanted to refresh.  But it looks like a
virtual host can only have one disk cache in it.  Is this true?

 

Thanks,

 

Lance Campbell

Project Manager/Software Architect

Web Services at Public Affairs

University of Illinois

217.333.0382

http://webservices.uiuc.edu

 


Re: [users@httpd] mod_disk_cache

Posted by Joshua Slive <jo...@slive.ca>.
On Jan 7, 2008 1:31 PM, Campbell, Lance <la...@uiuc.edu> wrote:
> It works!  Thanks!
>
> They really need to add that to the apache documentation.

There's a lot of stuff about mod_cache that is not explicitly
documented. This is because mod_cache is supposed to be a fairly
strict implementation of RFC 2616 caching rules, so it is assumed that
you know the standard. But there is lots of room on the httpd wiki for
useful tips like this one, if you want to go add it.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] mod_disk_cache

Posted by "Campbell, Lance" <la...@uiuc.edu>.
It works!  Thanks!

They really need to add that to the apache documentation.

Lance Campbell
Project Manager/Software Architect
Web Services at Public Affairs
University of Illinois
217.333.0382
http://webservices.uiuc.edu
 

-----Original Message-----
From: jslive@gmail.com [mailto:jslive@gmail.com] On Behalf Of Joshua
Slive
Sent: Monday, January 07, 2008 11:27 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] mod_disk_cache

On Jan 7, 2008 12:12 PM, Campbell, Lance <la...@uiuc.edu> wrote:
> Joshua,
> I don't understand what you are saying.  Is there some command
parameter
> you can send to htcacheclean or is there a special way of formatting
the
> requested cached URL that will cause it to be refreshed?

Just make an HTTP request to the server for the targeted URL with a
"Cache-Control: max-age=0" header.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] mod_disk_cache

Posted by Axel-Stephane SMORGRAV <Ax...@europe.adp.com>.
Lance,

I was surprised that you reported that the Cache: max-age=0 forced a revalidation of the resource with the origin server. There is a BR in Bugzilla for this (actually there are several) for which I provided a patch against 2.0.59:

http://issues.apache.org/bugzilla/show_bug.cgi?id=19441

>From memory there is at least one other RFC2616 compliance issue regarding the no-cache request directive.

The bottom line is that if you want to use mod_cache with 2.0 you are on your own. If you can you should migrate to 2.2.4 or 2.2.8 whenever it is released. If have run mod_cache 2.2.4 against a test suite of my own, and it passed all the tests that failed with 2.0.

-ascs
 
-----Message d'origine-----
De : Campbell, Lance [mailto:lance@uiuc.edu] 
Envoyé : mardi 8 janvier 2008 19:32
À : users@httpd.apache.org
Cc : jslive@gmail.com
Objet : RE: [users@httpd] mod_disk_cache

Joshua,
I thought this was working but it is not.  This is my sinario:

1) I have a Java servlet that serves up some content.  I put a display in the code so I can confirm when it gets called.  I also put some code in the servlet to display header parameters that it receives.

2) I clear my disk cache for apache.

3) I restart apache.

4) I hit the servlet through a browser.  The log file shows that it was hit.  I also notice that there is files in the apache disk cache.

5) I then hit the servlet again through a browser.  Nothing comes through the log file.  So the servlet never received the request but the page came up.  So apache is caching the file.

6) I now trigger another servlet that sends the same URL that I put manually into the browser.  This request has the parameter
"Cache-Control: max-age=0" added to the header.  The servlet I have been talking to shows that it receives a request.  The header shows the following name value pairs:

header name=Cache-Control
header value=max-age=0
header name=pragma
header value=no-cache
header name=user-agent
header value=Java/1.6.0_02
header name=host
header value=qa.webtools.uiuc.edu
header name=accept
header value=text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 header name=connection header value=keep-alive header name=content-length header value=0

When I go to the original servlet again I find the content is still the cached content.  It is as though the disk cache module let my request go on through but it did not delete/refresh the data.

What should I do?

Lance Campbell
Project Manager/Software Architect
Web Services at Public Affairs
University of Illinois
217.333.0382
http://webservices.uiuc.edu
 
-----Original Message-----
From: jslive@gmail.com [mailto:jslive@gmail.com] On Behalf Of Joshua Slive
Sent: Monday, January 07, 2008 11:27 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] mod_disk_cache

On Jan 7, 2008 12:12 PM, Campbell, Lance <la...@uiuc.edu> wrote:
> Joshua,
> I don't understand what you are saying.  Is there some command
parameter
> you can send to htcacheclean or is there a special way of formatting
the
> requested cached URL that will cause it to be refreshed?

Just make an HTTP request to the server for the targeted URL with a
"Cache-Control: max-age=0" header.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] mod_disk_cache

Posted by "Campbell, Lance" <la...@uiuc.edu>.
Joshua,
I thought this was working but it is not.  This is my sinario:

1) I have a Java servlet that serves up some content.  I put a display
in the code so I can confirm when it gets called.  I also put some code
in the servlet to display header parameters that it receives.

2) I clear my disk cache for apache.

3) I restart apache.

4) I hit the servlet through a browser.  The log file shows that it was
hit.  I also notice that there is files in the apache disk cache.

5) I then hit the servlet again through a browser.  Nothing comes
through the log file.  So the servlet never received the request but the
page came up.  So apache is caching the file.

6) I now trigger another servlet that sends the same URL that I put
manually into the browser.  This request has the parameter
"Cache-Control: max-age=0" added to the header.  The servlet I have been
talking to shows that it receives a request.  The header shows the
following name value pairs:

header name=Cache-Control
header value=max-age=0
header name=pragma
header value=no-cache
header name=user-agent
header value=Java/1.6.0_02
header name=host
header value=qa.webtools.uiuc.edu
header name=accept
header value=text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
header name=connection
header value=keep-alive
header name=content-length
header value=0

When I go to the original servlet again I find the content is still the
cached content.  It is as though the disk cache module let my request go
on through but it did not delete/refresh the data.

What should I do?

Lance Campbell
Project Manager/Software Architect
Web Services at Public Affairs
University of Illinois
217.333.0382
http://webservices.uiuc.edu
 
-----Original Message-----
From: jslive@gmail.com [mailto:jslive@gmail.com] On Behalf Of Joshua
Slive
Sent: Monday, January 07, 2008 11:27 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] mod_disk_cache

On Jan 7, 2008 12:12 PM, Campbell, Lance <la...@uiuc.edu> wrote:
> Joshua,
> I don't understand what you are saying.  Is there some command
parameter
> you can send to htcacheclean or is there a special way of formatting
the
> requested cached URL that will cause it to be refreshed?

Just make an HTTP request to the server for the targeted URL with a
"Cache-Control: max-age=0" header.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_disk_cache

Posted by Joshua Slive <jo...@slive.ca>.
On Jan 7, 2008 12:12 PM, Campbell, Lance <la...@uiuc.edu> wrote:
> Joshua,
> I don't understand what you are saying.  Is there some command parameter
> you can send to htcacheclean or is there a special way of formatting the
> requested cached URL that will cause it to be refreshed?

Just make an HTTP request to the server for the targeted URL with a
"Cache-Control: max-age=0" header.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] mod_disk_cache

Posted by "Campbell, Lance" <la...@uiuc.edu>.
Joshua,
I don't understand what you are saying.  Is there some command parameter
you can send to htcacheclean or is there a special way of formatting the
requested cached URL that will cause it to be refreshed? 

Since I am caching Tomcat dynamic content I use the following parameters
when setting up the mod_disk_cache:

    CacheRoot /a/b/c/d/e
    CacheSize 256
    CacheEnable disk /servletName/
    CacheDefaultExpire 3600
    CacheDirLevels 2
    CacheDirLength 10
    CacheIgnoreCacheControl off
    CacheIgnoreHeaders None
    CacheIgnoreNoLastMod On
    CacheDefaultExpire 600                     
    CacheMaxExpire 3600

Thanks,

Lance Campbell
Project Manager/Software Architect
Web Services at Public Affairs
University of Illinois
217.333.0382
http://webservices.uiuc.edu
 

-----Original Message-----
From: jslive@gmail.com [mailto:jslive@gmail.com] On Behalf Of Joshua
Slive
Sent: Monday, January 07, 2008 10:46 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] mod_disk_cache

On Jan 7, 2008 12:59 AM, Campbell, Lance <la...@uiuc.edu> wrote:
>
>
>
>
> httpd-2.0.59
>
>
>
> Does mod_disk_cache support a mechanism that one can request a
particular
> URL to have its content refreshed?

Sure, if you send the appropriate Cache-Control headers on your
request, you should force mod_cache to get the data from the back-end.
(But I haven't tested this myself.)

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_disk_cache

Posted by Joshua Slive <jo...@slive.ca>.
On Jan 7, 2008 12:59 AM, Campbell, Lance <la...@uiuc.edu> wrote:
>
>
>
>
> httpd-2.0.59
>
>
>
> Does mod_disk_cache support a mechanism that one can request a particular
> URL to have its content refreshed?

Sure, if you send the appropriate Cache-Control headers on your
request, you should force mod_cache to get the data from the back-end.
(But I haven't tested this myself.)

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org