You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Karim Zaki <Ka...@itworx.com> on 2008/11/30 15:59:23 UTC

[users@httpd] Clearing cache selectively on Apache + mod_cache

Greetings all,

I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?

Thanks,
Karim

-------------------------------------------------------------------------------
"Although the moon is smaller than the earth, it is farther away."


RE: [users@httpd] Clearing cache selectively on Apache + mod_cache

Posted by Karim Zaki <Ka...@itworx.com>.
Another update. It was possible to make it happen using virtual hosts by setting the ServerName attribute of both virtual hosts the same, with the only difference being that one of them has CacheIgnoreCacheControl set to On, and the other to Off, and then sending a request to that host with cache-control: no-cache. I think this is the way it's going to have to work.

Thanks again to everyone for your contributions.

-----Original Message-----
From: Karim Zaki [mailto:Karim.Zaki@itworx.com]
Sent: Tuesday, December 02, 2008 1:07 PM
To: users@httpd.apache.org
Subject: RE: [users@httpd] Clearing cache selectively on Apache + mod_cache

Seems I'm back at square 1. The idea of using max-age=0 did not work, which, on second thought, makes sense. CacheIgnoreCacheControl should ignore the "cache-control" header regardless of its value. The virtual host solution did not work either. It created new cache entries for the vhost.

-----Original Message-----
From: André Warnier [mailto:aw@ice-sa.com]
Sent: Monday, December 01, 2008 6:20 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache

Eric Covener wrote:
> On Mon, Dec 1, 2008 at 11:09 AM, André Warnier <aw...@ice-sa.com> wrote:
>> Which leads me to believe that, as such, the scheme proposed with the
>> separate VirtualHost will not work as simply as expected.
>
> Yep, it looks like you'd need to jump through hoops to have a vhost
> that was able to nuke these requests (using the same hostname on a
> separate interface).

Just intellectual curiosity : other than going through the source code
of mod_cache, is there a description somewhere of the algorithm used by
mod_cache to calculate this hashcode ?


---------------------------------------------------------------------
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] Clearing cache selectively on Apache + mod_cache

Posted by André Warnier <aw...@ice-sa.com>.
André Warnier wrote:
> Indeed.
> So either you create a sript/program that goes directly in the cache and 
> clears the document (which would mean you can recalculate the hash that 
> mod_cache uses for a given URL), or else you find another clever way.
> 
This is yet another idea.
I just downloaded the source code for the latest Apache, and had a look 
at the hashkeys related stuff.
That is
support/htcacheclean.c
modules/cache/cache_hash.h
modules/cache/cache_hash.c

I am not a C programmer, but the impression I get, is that it would not 
be so difficult to modify htcacheclean to add another command-line 
option to it.
This command-line option would take the URL of a cached object, and go 
off and delete it from the cache.

Since that could be considered a useful addition "in general" to 
htcacheclean, maybe one of the mod_cache developers would be interested ?



---------------------------------------------------------------------
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] Clearing cache selectively on Apache + mod_cache

Posted by André Warnier <aw...@ice-sa.com>.
Indeed.
So either you create a sript/program that goes directly in the cache and 
clears the document (which would mean you can recalculate the hash that 
mod_cache uses for a given URL), or else you find another clever way.

Let's say that for Tomcat, the expensive part of the operation is to 
re-generate the PDF response.  But since this seems to be some kind of 
database-based application, I imagine that :
- when your application on Tomcat gets a request for an item, it goes 
off into the database to retrieve the information, then formats this 
into a PDF and sends this as a response. That's expensive.
- but the information in the database must have some kind of timestamp, 
since you can determine when the response would need to be regenerated 
and when not.
- so what about your application checking first if the information is 
really "new", and if not returning some other kind of response to the 
caller (in this case the caller would be Apache/mod_cache).

What I mean is a bit complicated to explain, but roughly :
- when mod_cache examines a request, it can find that the document is 
not in the cache, and then the request goes through to Tomcat.  The 
response from Tomcat is then stored in the cache, by a filter set up by 
mod_cache for this request and for this purpose.  I imagine that in this 
case, the request as it goes to Tomcat is "unconditional", meaning that 
it tells Tomcat "give me this document, no matter what".
- on the other hand, when mod_cache finds the document already in the 
cache, it must still, under certain circumstances, let a request go 
through to Tomcat, to verify that the cached document is still valid.

I am not quite clear myself on which combination of circumstances and 
request and response headers control this behaviour, but I have a 
feeling somehow that it must be possible to play with this, to avoid the 
Tomcat application having to unnecessarily generate those expensive PDF 
answers.  It would still get calls, and would still need to interrogate 
the database, but in many cases it could answer with something like a 
"Not modified" status instead of a new PDF.

Any real guru available here ?




Karim Zaki wrote:
> Seems I'm back at square 1. The idea of using max-age=0 did not work, which, on second thought, makes sense. CacheIgnoreCacheControl should ignore the "cache-control" header regardless of its value. The virtual host solution did not work either. It created new cache entries for the vhost.
> 
> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com]
> Sent: Monday, December 01, 2008 6:20 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
> 
> Eric Covener wrote:
>> On Mon, Dec 1, 2008 at 11:09 AM, André Warnier <aw...@ice-sa.com> wrote:
>>> Which leads me to believe that, as such, the scheme proposed with the
>>> separate VirtualHost will not work as simply as expected.
>> Yep, it looks like you'd need to jump through hoops to have a vhost
>> that was able to nuke these requests (using the same hostname on a
>> separate interface).
> 
> Just intellectual curiosity : other than going through the source code
> of mod_cache, is there a description somewhere of the algorithm used by
> mod_cache to calculate this hashcode ?
> 
> 
> ---------------------------------------------------------------------
> 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] Clearing cache selectively on Apache + mod_cache

Posted by Karim Zaki <Ka...@itworx.com>.
Seems I'm back at square 1. The idea of using max-age=0 did not work, which, on second thought, makes sense. CacheIgnoreCacheControl should ignore the "cache-control" header regardless of its value. The virtual host solution did not work either. It created new cache entries for the vhost.

-----Original Message-----
From: André Warnier [mailto:aw@ice-sa.com]
Sent: Monday, December 01, 2008 6:20 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache

Eric Covener wrote:
> On Mon, Dec 1, 2008 at 11:09 AM, André Warnier <aw...@ice-sa.com> wrote:
>> Which leads me to believe that, as such, the scheme proposed with the
>> separate VirtualHost will not work as simply as expected.
>
> Yep, it looks like you'd need to jump through hoops to have a vhost
> that was able to nuke these requests (using the same hostname on a
> separate interface).

Just intellectual curiosity : other than going through the source code
of mod_cache, is there a description somewhere of the algorithm used by
mod_cache to calculate this hashcode ?


---------------------------------------------------------------------
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] Clearing cache selectively on Apache + mod_cache

Posted by André Warnier <aw...@ice-sa.com>.
Eric Covener wrote:
> On Mon, Dec 1, 2008 at 11:09 AM, André Warnier <aw...@ice-sa.com> wrote:
>> Which leads me to believe that, as such, the scheme proposed with the
>> separate VirtualHost will not work as simply as expected.
> 
> Yep, it looks like you'd need to jump through hoops to have a vhost
> that was able to nuke these requests (using the same hostname on a
> separate interface).

Just intellectual curiosity : other than going through the source code 
of mod_cache, is there a description somewhere of the algorithm used by 
mod_cache to calculate this hashcode ?


---------------------------------------------------------------------
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] Clearing cache selectively on Apache + mod_cache

Posted by Eric Covener <co...@gmail.com>.
On Mon, Dec 1, 2008 at 11:09 AM, André Warnier <aw...@ice-sa.com> wrote:
> Which leads me to believe that, as such, the scheme proposed with the
> separate VirtualHost will not work as simply as expected.

Yep, it looks like you'd need to jump through hoops to have a vhost
that was able to nuke these requests (using the same hostname on a
separate interface).
-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] Clearing cache selectively on Apache + mod_cache

Posted by Karim Zaki <Ka...@itworx.com>.
That's not great news. When you say the hostname, do you mean ServerName or the address configured for the virtual host? I don't have any problems setting the same ServerName for both.

-----Original Message-----
From: André Warnier [mailto:aw@ice-sa.com]
Sent: Monday, December 01, 2008 6:10 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache

One last note : following your original post, I re-read the Apache
documentation on "caching content" (never a bad idea, that).
In there, I saw something about the fact that in order to cache content,
mod_cache calculates a hashcode for the URL to cache, in which
calculation is included (and that is the important part) the *hostname*
(for example the name of your VirtualHost).
Which leads me to believe that, as such, the scheme proposed with the
separate VirtualHost will not work as simply as expected.
There is also somewhere in there the indication that you can overcome
this by using another directive, but I have no idea if that would have
or not other undesirable consequences in your case.


Karim Zaki wrote:
> I think I will try using the virtual host option first..
>
> Thanks to everyone for your contributions to the discussion.
>
> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com]
> Sent: Monday, December 01, 2008 3:54 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>
> When I look at this series of messages, and at a previous thread on this
> list, with subject : Best filesystem type for mod_cache in reverse proxy?
> and at this :
> http://httpd.apache.org/docs/2.2/caching.html
> then I get the idea that the directory/file structure used by
> mod_disk_cache is not so complex.
> It might thus be possible to write a simple script which, based on the
> URL of the page that has changed in Tomcat, just goes into that file
> structure and deletes that document.
> After all, this seems to be the way in which htcacheclean is doing it.
> What I do not know is if between htcacheclean and mod_cache, there is
> any synchronisation happening.
>
> Alternatively, if your Apache server already has mod_perl loaded, there
> are probably a couple of ways that this can be done with a mod_perl
> module.  But you probably would not want to load mod_perl just for that.
>
> Karim Zaki wrote:
>> Yes. When a page changes, this fires an event, which I can catch and run some code. I would like that code to clear the cache for this specific page.
>>
>> -----Original Message-----
>> From: André Warnier [mailto:aw@ice-sa.com]
>> Sent: Monday, December 01, 2008 2:50 PM
>> To: users@httpd.apache.org
>> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>>
>> Ok then.
>> So, how do you know that a given page changed ?
>> I mean, if you don't want to wait, it means you have some way to know
>> that the page has changed for which you don't want to wait, right ?
>>
>>
>> Karim Zaki wrote:
>>> This is exactly what is in place right now. I've written a filter in Tomcat to set the "Expires" header, and Apache honors it. However, when a page changes, I don't want to have to wait 24 hours for that change to reflect in the cache, and I don't want to have to clear the whole cache either. I want to selectively "push" the change to the cache by clearing that specific page from the apache cache so that the next time it is requested, it will be regenerated with the new content and cached.
>>>
>>> -----Original Message-----
>>> From: André Warnier [mailto:aw@ice-sa.com]
>>> Sent: Monday, December 01, 2008 1:36 PM
>>> To: users@httpd.apache.org
>>> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>>>
>>> I guess it all depends on your definition of "dynamic", and how you
>>> handle this at the source.
>>>
>>> When your Tomcat generates an answer page, it can add HTTP headers that
>>> indicate for how long this content is valid.  If it doesn't, then by
>>> default this means that the page is effectively "dynamic" (meaning that
>>> each request could theoretically return a different answer next time).
>>> What I mean by this, is that if your Tomcat added the right "Expires"
>>> header in the first place (saying 24 hours), then you would have what
>>> you seem to want, without having to do anything special in addition.
>>> I would expect mod_cache at the Apache level, to take this information
>>> into account, and serve the local copy instead of asking Tomcat again,
>>> at least during these 24 hours. Then, when mod_cache realises that the
>>> page's "valid until" date has passed, it will request a new version from
>>> Tomcat automatically.
>>>
>>> So, is there any particular reason why the above scheme is not
>>> applicable in your case ?
>>>
>>>
>>> Karim Zaki wrote:
>>>> But that would be like re-implementing mod_cache, wouldn't it? Apache is already doing this for me. It's caching the dynamic content, keeping it for 24 hours, and checking if it's in cache before requesting it from the back-end server. The only problem is that I need to sometimes clear certain pages from cache.
>>>>
>>>> -----Original Message-----
>>>> From: André Warnier [mailto:aw@ice-sa.com]
>>>> Sent: Monday, December 01, 2008 1:00 PM
>>>> To: users@httpd.apache.org
>>>> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>>>>
>>>> Karim Zaki wrote:
>>>>> Greetings all,
>>>>>
>>>>> I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?
>>>>>
>>>> Hi.
>>>> I am not going to answer your original question, but I just have a
>>>> couple of remarks based on your description above, and maybe a different
>>>> way of thinking about this.
>>>>
>>>> You say that you want to cache dynamic content generated by Tomcat, for
>>>> 24 hours.
>>>> In other words, it is not really dynamic content, because for 24 hours
>>>> your users are going to get the same unique version.
>>>>
>>>> If so, then why would you not generate these pages in advance, and put
>>>> them somewhere on your Apache server to be served as static content ?
>>>> Then each 24 hours you can do the same and refresh them from Tomcat.
>>>> (This would be fairly simple to do using a script, calling something
>>>> like wget or curl, or in perl using LWP).
>>>>
>>>> I believe it is fairly simple to configure your Apache in such a way
>>>> that it will look first of this URL is available as a static page, and
>>>> if not forward the call to Tomcat.
>>>> (using mod_rewrite e.g.).
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>
>
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
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] Clearing cache selectively on Apache + mod_cache

Posted by André Warnier <aw...@ice-sa.com>.
One last note : following your original post, I re-read the Apache 
documentation on "caching content" (never a bad idea, that).
In there, I saw something about the fact that in order to cache content, 
mod_cache calculates a hashcode for the URL to cache, in which 
calculation is included (and that is the important part) the *hostname* 
(for example the name of your VirtualHost).
Which leads me to believe that, as such, the scheme proposed with the 
separate VirtualHost will not work as simply as expected.
There is also somewhere in there the indication that you can overcome 
this by using another directive, but I have no idea if that would have 
or not other undesirable consequences in your case.


Karim Zaki wrote:
> I think I will try using the virtual host option first..
> 
> Thanks to everyone for your contributions to the discussion.
> 
> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com]
> Sent: Monday, December 01, 2008 3:54 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
> 
> When I look at this series of messages, and at a previous thread on this
> list, with subject : Best filesystem type for mod_cache in reverse proxy?
> and at this :
> http://httpd.apache.org/docs/2.2/caching.html
> then I get the idea that the directory/file structure used by
> mod_disk_cache is not so complex.
> It might thus be possible to write a simple script which, based on the
> URL of the page that has changed in Tomcat, just goes into that file
> structure and deletes that document.
> After all, this seems to be the way in which htcacheclean is doing it.
> What I do not know is if between htcacheclean and mod_cache, there is
> any synchronisation happening.
> 
> Alternatively, if your Apache server already has mod_perl loaded, there
> are probably a couple of ways that this can be done with a mod_perl
> module.  But you probably would not want to load mod_perl just for that.
> 
> Karim Zaki wrote:
>> Yes. When a page changes, this fires an event, which I can catch and run some code. I would like that code to clear the cache for this specific page.
>>
>> -----Original Message-----
>> From: André Warnier [mailto:aw@ice-sa.com]
>> Sent: Monday, December 01, 2008 2:50 PM
>> To: users@httpd.apache.org
>> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>>
>> Ok then.
>> So, how do you know that a given page changed ?
>> I mean, if you don't want to wait, it means you have some way to know
>> that the page has changed for which you don't want to wait, right ?
>>
>>
>> Karim Zaki wrote:
>>> This is exactly what is in place right now. I've written a filter in Tomcat to set the "Expires" header, and Apache honors it. However, when a page changes, I don't want to have to wait 24 hours for that change to reflect in the cache, and I don't want to have to clear the whole cache either. I want to selectively "push" the change to the cache by clearing that specific page from the apache cache so that the next time it is requested, it will be regenerated with the new content and cached.
>>>
>>> -----Original Message-----
>>> From: André Warnier [mailto:aw@ice-sa.com]
>>> Sent: Monday, December 01, 2008 1:36 PM
>>> To: users@httpd.apache.org
>>> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>>>
>>> I guess it all depends on your definition of "dynamic", and how you
>>> handle this at the source.
>>>
>>> When your Tomcat generates an answer page, it can add HTTP headers that
>>> indicate for how long this content is valid.  If it doesn't, then by
>>> default this means that the page is effectively "dynamic" (meaning that
>>> each request could theoretically return a different answer next time).
>>> What I mean by this, is that if your Tomcat added the right "Expires"
>>> header in the first place (saying 24 hours), then you would have what
>>> you seem to want, without having to do anything special in addition.
>>> I would expect mod_cache at the Apache level, to take this information
>>> into account, and serve the local copy instead of asking Tomcat again,
>>> at least during these 24 hours. Then, when mod_cache realises that the
>>> page's "valid until" date has passed, it will request a new version from
>>> Tomcat automatically.
>>>
>>> So, is there any particular reason why the above scheme is not
>>> applicable in your case ?
>>>
>>>
>>> Karim Zaki wrote:
>>>> But that would be like re-implementing mod_cache, wouldn't it? Apache is already doing this for me. It's caching the dynamic content, keeping it for 24 hours, and checking if it's in cache before requesting it from the back-end server. The only problem is that I need to sometimes clear certain pages from cache.
>>>>
>>>> -----Original Message-----
>>>> From: André Warnier [mailto:aw@ice-sa.com]
>>>> Sent: Monday, December 01, 2008 1:00 PM
>>>> To: users@httpd.apache.org
>>>> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>>>>
>>>> Karim Zaki wrote:
>>>>> Greetings all,
>>>>>
>>>>> I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?
>>>>>
>>>> Hi.
>>>> I am not going to answer your original question, but I just have a
>>>> couple of remarks based on your description above, and maybe a different
>>>> way of thinking about this.
>>>>
>>>> You say that you want to cache dynamic content generated by Tomcat, for
>>>> 24 hours.
>>>> In other words, it is not really dynamic content, because for 24 hours
>>>> your users are going to get the same unique version.
>>>>
>>>> If so, then why would you not generate these pages in advance, and put
>>>> them somewhere on your Apache server to be served as static content ?
>>>> Then each 24 hours you can do the same and refresh them from Tomcat.
>>>> (This would be fairly simple to do using a script, calling something
>>>> like wget or curl, or in perl using LWP).
>>>>
>>>> I believe it is fairly simple to configure your Apache in such a way
>>>> that it will look first of this URL is available as a static page, and
>>>> if not forward the call to Tomcat.
>>>> (using mod_rewrite e.g.).
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
> 
> 
> ---------------------------------------------------------------------
> 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] Clearing cache selectively on Apache + mod_cache

Posted by Karim Zaki <Ka...@itworx.com>.
I think I will try using the virtual host option first..

Thanks to everyone for your contributions to the discussion.

-----Original Message-----
From: André Warnier [mailto:aw@ice-sa.com]
Sent: Monday, December 01, 2008 3:54 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache

When I look at this series of messages, and at a previous thread on this
list, with subject : Best filesystem type for mod_cache in reverse proxy?
and at this :
http://httpd.apache.org/docs/2.2/caching.html
then I get the idea that the directory/file structure used by
mod_disk_cache is not so complex.
It might thus be possible to write a simple script which, based on the
URL of the page that has changed in Tomcat, just goes into that file
structure and deletes that document.
After all, this seems to be the way in which htcacheclean is doing it.
What I do not know is if between htcacheclean and mod_cache, there is
any synchronisation happening.

Alternatively, if your Apache server already has mod_perl loaded, there
are probably a couple of ways that this can be done with a mod_perl
module.  But you probably would not want to load mod_perl just for that.

Karim Zaki wrote:
> Yes. When a page changes, this fires an event, which I can catch and run some code. I would like that code to clear the cache for this specific page.
>
> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com]
> Sent: Monday, December 01, 2008 2:50 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>
> Ok then.
> So, how do you know that a given page changed ?
> I mean, if you don't want to wait, it means you have some way to know
> that the page has changed for which you don't want to wait, right ?
>
>
> Karim Zaki wrote:
>> This is exactly what is in place right now. I've written a filter in Tomcat to set the "Expires" header, and Apache honors it. However, when a page changes, I don't want to have to wait 24 hours for that change to reflect in the cache, and I don't want to have to clear the whole cache either. I want to selectively "push" the change to the cache by clearing that specific page from the apache cache so that the next time it is requested, it will be regenerated with the new content and cached.
>>
>> -----Original Message-----
>> From: André Warnier [mailto:aw@ice-sa.com]
>> Sent: Monday, December 01, 2008 1:36 PM
>> To: users@httpd.apache.org
>> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>>
>> I guess it all depends on your definition of "dynamic", and how you
>> handle this at the source.
>>
>> When your Tomcat generates an answer page, it can add HTTP headers that
>> indicate for how long this content is valid.  If it doesn't, then by
>> default this means that the page is effectively "dynamic" (meaning that
>> each request could theoretically return a different answer next time).
>> What I mean by this, is that if your Tomcat added the right "Expires"
>> header in the first place (saying 24 hours), then you would have what
>> you seem to want, without having to do anything special in addition.
>> I would expect mod_cache at the Apache level, to take this information
>> into account, and serve the local copy instead of asking Tomcat again,
>> at least during these 24 hours. Then, when mod_cache realises that the
>> page's "valid until" date has passed, it will request a new version from
>> Tomcat automatically.
>>
>> So, is there any particular reason why the above scheme is not
>> applicable in your case ?
>>
>>
>> Karim Zaki wrote:
>>> But that would be like re-implementing mod_cache, wouldn't it? Apache is already doing this for me. It's caching the dynamic content, keeping it for 24 hours, and checking if it's in cache before requesting it from the back-end server. The only problem is that I need to sometimes clear certain pages from cache.
>>>
>>> -----Original Message-----
>>> From: André Warnier [mailto:aw@ice-sa.com]
>>> Sent: Monday, December 01, 2008 1:00 PM
>>> To: users@httpd.apache.org
>>> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>>>
>>> Karim Zaki wrote:
>>>> Greetings all,
>>>>
>>>> I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?
>>>>
>>> Hi.
>>> I am not going to answer your original question, but I just have a
>>> couple of remarks based on your description above, and maybe a different
>>> way of thinking about this.
>>>
>>> You say that you want to cache dynamic content generated by Tomcat, for
>>> 24 hours.
>>> In other words, it is not really dynamic content, because for 24 hours
>>> your users are going to get the same unique version.
>>>
>>> If so, then why would you not generate these pages in advance, and put
>>> them somewhere on your Apache server to be served as static content ?
>>> Then each 24 hours you can do the same and refresh them from Tomcat.
>>> (This would be fairly simple to do using a script, calling something
>>> like wget or curl, or in perl using LWP).
>>>
>>> I believe it is fairly simple to configure your Apache in such a way
>>> that it will look first of this URL is available as a static page, and
>>> if not forward the call to Tomcat.
>>> (using mod_rewrite e.g.).
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>


---------------------------------------------------------------------
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] Clearing cache selectively on Apache + mod_cache

Posted by André Warnier <aw...@ice-sa.com>.
When I look at this series of messages, and at a previous thread on this 
list, with subject : Best filesystem type for mod_cache in reverse proxy?
and at this :
http://httpd.apache.org/docs/2.2/caching.html
then I get the idea that the directory/file structure used by 
mod_disk_cache is not so complex.
It might thus be possible to write a simple script which, based on the 
URL of the page that has changed in Tomcat, just goes into that file 
structure and deletes that document.
After all, this seems to be the way in which htcacheclean is doing it.
What I do not know is if between htcacheclean and mod_cache, there is 
any synchronisation happening.

Alternatively, if your Apache server already has mod_perl loaded, there 
are probably a couple of ways that this can be done with a mod_perl 
module.  But you probably would not want to load mod_perl just for that.

Karim Zaki wrote:
> Yes. When a page changes, this fires an event, which I can catch and run some code. I would like that code to clear the cache for this specific page.
> 
> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com]
> Sent: Monday, December 01, 2008 2:50 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
> 
> Ok then.
> So, how do you know that a given page changed ?
> I mean, if you don't want to wait, it means you have some way to know
> that the page has changed for which you don't want to wait, right ?
> 
> 
> Karim Zaki wrote:
>> This is exactly what is in place right now. I've written a filter in Tomcat to set the "Expires" header, and Apache honors it. However, when a page changes, I don't want to have to wait 24 hours for that change to reflect in the cache, and I don't want to have to clear the whole cache either. I want to selectively "push" the change to the cache by clearing that specific page from the apache cache so that the next time it is requested, it will be regenerated with the new content and cached.
>>
>> -----Original Message-----
>> From: André Warnier [mailto:aw@ice-sa.com]
>> Sent: Monday, December 01, 2008 1:36 PM
>> To: users@httpd.apache.org
>> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>>
>> I guess it all depends on your definition of "dynamic", and how you
>> handle this at the source.
>>
>> When your Tomcat generates an answer page, it can add HTTP headers that
>> indicate for how long this content is valid.  If it doesn't, then by
>> default this means that the page is effectively "dynamic" (meaning that
>> each request could theoretically return a different answer next time).
>> What I mean by this, is that if your Tomcat added the right "Expires"
>> header in the first place (saying 24 hours), then you would have what
>> you seem to want, without having to do anything special in addition.
>> I would expect mod_cache at the Apache level, to take this information
>> into account, and serve the local copy instead of asking Tomcat again,
>> at least during these 24 hours. Then, when mod_cache realises that the
>> page's "valid until" date has passed, it will request a new version from
>> Tomcat automatically.
>>
>> So, is there any particular reason why the above scheme is not
>> applicable in your case ?
>>
>>
>> Karim Zaki wrote:
>>> But that would be like re-implementing mod_cache, wouldn't it? Apache is already doing this for me. It's caching the dynamic content, keeping it for 24 hours, and checking if it's in cache before requesting it from the back-end server. The only problem is that I need to sometimes clear certain pages from cache.
>>>
>>> -----Original Message-----
>>> From: André Warnier [mailto:aw@ice-sa.com]
>>> Sent: Monday, December 01, 2008 1:00 PM
>>> To: users@httpd.apache.org
>>> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>>>
>>> Karim Zaki wrote:
>>>> Greetings all,
>>>>
>>>> I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?
>>>>
>>> Hi.
>>> I am not going to answer your original question, but I just have a
>>> couple of remarks based on your description above, and maybe a different
>>> way of thinking about this.
>>>
>>> You say that you want to cache dynamic content generated by Tomcat, for
>>> 24 hours.
>>> In other words, it is not really dynamic content, because for 24 hours
>>> your users are going to get the same unique version.
>>>
>>> If so, then why would you not generate these pages in advance, and put
>>> them somewhere on your Apache server to be served as static content ?
>>> Then each 24 hours you can do the same and refresh them from Tomcat.
>>> (This would be fairly simple to do using a script, calling something
>>> like wget or curl, or in perl using LWP).
>>>
>>> I believe it is fairly simple to configure your Apache in such a way
>>> that it will look first of this URL is available as a static page, and
>>> if not forward the call to Tomcat.
>>> (using mod_rewrite e.g.).
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 


---------------------------------------------------------------------
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] Clearing cache selectively on Apache + mod_cache

Posted by Karim Zaki <Ka...@itworx.com>.
Yes. When a page changes, this fires an event, which I can catch and run some code. I would like that code to clear the cache for this specific page.

-----Original Message-----
From: André Warnier [mailto:aw@ice-sa.com]
Sent: Monday, December 01, 2008 2:50 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache

Ok then.
So, how do you know that a given page changed ?
I mean, if you don't want to wait, it means you have some way to know
that the page has changed for which you don't want to wait, right ?


Karim Zaki wrote:
> This is exactly what is in place right now. I've written a filter in Tomcat to set the "Expires" header, and Apache honors it. However, when a page changes, I don't want to have to wait 24 hours for that change to reflect in the cache, and I don't want to have to clear the whole cache either. I want to selectively "push" the change to the cache by clearing that specific page from the apache cache so that the next time it is requested, it will be regenerated with the new content and cached.
>
> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com]
> Sent: Monday, December 01, 2008 1:36 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>
> I guess it all depends on your definition of "dynamic", and how you
> handle this at the source.
>
> When your Tomcat generates an answer page, it can add HTTP headers that
> indicate for how long this content is valid.  If it doesn't, then by
> default this means that the page is effectively "dynamic" (meaning that
> each request could theoretically return a different answer next time).
> What I mean by this, is that if your Tomcat added the right "Expires"
> header in the first place (saying 24 hours), then you would have what
> you seem to want, without having to do anything special in addition.
> I would expect mod_cache at the Apache level, to take this information
> into account, and serve the local copy instead of asking Tomcat again,
> at least during these 24 hours. Then, when mod_cache realises that the
> page's "valid until" date has passed, it will request a new version from
> Tomcat automatically.
>
> So, is there any particular reason why the above scheme is not
> applicable in your case ?
>
>
> Karim Zaki wrote:
>> But that would be like re-implementing mod_cache, wouldn't it? Apache is already doing this for me. It's caching the dynamic content, keeping it for 24 hours, and checking if it's in cache before requesting it from the back-end server. The only problem is that I need to sometimes clear certain pages from cache.
>>
>> -----Original Message-----
>> From: André Warnier [mailto:aw@ice-sa.com]
>> Sent: Monday, December 01, 2008 1:00 PM
>> To: users@httpd.apache.org
>> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>>
>> Karim Zaki wrote:
>>> Greetings all,
>>>
>>> I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?
>>>
>> Hi.
>> I am not going to answer your original question, but I just have a
>> couple of remarks based on your description above, and maybe a different
>> way of thinking about this.
>>
>> You say that you want to cache dynamic content generated by Tomcat, for
>> 24 hours.
>> In other words, it is not really dynamic content, because for 24 hours
>> your users are going to get the same unique version.
>>
>> If so, then why would you not generate these pages in advance, and put
>> them somewhere on your Apache server to be served as static content ?
>> Then each 24 hours you can do the same and refresh them from Tomcat.
>> (This would be fairly simple to do using a script, calling something
>> like wget or curl, or in perl using LWP).
>>
>> I believe it is fairly simple to configure your Apache in such a way
>> that it will look first of this URL is available as a static page, and
>> if not forward the call to Tomcat.
>> (using mod_rewrite e.g.).
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
> ---------------------------------------------------------------------
> 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] Clearing cache selectively on Apache + mod_cache

Posted by André Warnier <aw...@ice-sa.com>.
Ok then.
So, how do you know that a given page changed ?
I mean, if you don't want to wait, it means you have some way to know 
that the page has changed for which you don't want to wait, right ?


Karim Zaki wrote:
> This is exactly what is in place right now. I've written a filter in Tomcat to set the "Expires" header, and Apache honors it. However, when a page changes, I don't want to have to wait 24 hours for that change to reflect in the cache, and I don't want to have to clear the whole cache either. I want to selectively "push" the change to the cache by clearing that specific page from the apache cache so that the next time it is requested, it will be regenerated with the new content and cached.
> 
> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com]
> Sent: Monday, December 01, 2008 1:36 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
> 
> I guess it all depends on your definition of "dynamic", and how you
> handle this at the source.
> 
> When your Tomcat generates an answer page, it can add HTTP headers that
> indicate for how long this content is valid.  If it doesn't, then by
> default this means that the page is effectively "dynamic" (meaning that
> each request could theoretically return a different answer next time).
> What I mean by this, is that if your Tomcat added the right "Expires"
> header in the first place (saying 24 hours), then you would have what
> you seem to want, without having to do anything special in addition.
> I would expect mod_cache at the Apache level, to take this information
> into account, and serve the local copy instead of asking Tomcat again,
> at least during these 24 hours. Then, when mod_cache realises that the
> page's "valid until" date has passed, it will request a new version from
> Tomcat automatically.
> 
> So, is there any particular reason why the above scheme is not
> applicable in your case ?
> 
> 
> Karim Zaki wrote:
>> But that would be like re-implementing mod_cache, wouldn't it? Apache is already doing this for me. It's caching the dynamic content, keeping it for 24 hours, and checking if it's in cache before requesting it from the back-end server. The only problem is that I need to sometimes clear certain pages from cache.
>>
>> -----Original Message-----
>> From: André Warnier [mailto:aw@ice-sa.com]
>> Sent: Monday, December 01, 2008 1:00 PM
>> To: users@httpd.apache.org
>> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>>
>> Karim Zaki wrote:
>>> Greetings all,
>>>
>>> I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?
>>>
>> Hi.
>> I am not going to answer your original question, but I just have a
>> couple of remarks based on your description above, and maybe a different
>> way of thinking about this.
>>
>> You say that you want to cache dynamic content generated by Tomcat, for
>> 24 hours.
>> In other words, it is not really dynamic content, because for 24 hours
>> your users are going to get the same unique version.
>>
>> If so, then why would you not generate these pages in advance, and put
>> them somewhere on your Apache server to be served as static content ?
>> Then each 24 hours you can do the same and refresh them from Tomcat.
>> (This would be fairly simple to do using a script, calling something
>> like wget or curl, or in perl using LWP).
>>
>> I believe it is fairly simple to configure your Apache in such a way
>> that it will look first of this URL is available as a static page, and
>> if not forward the call to Tomcat.
>> (using mod_rewrite e.g.).
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> ---------------------------------------------------------------------
> 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] Clearing cache selectively on Apache + mod_cache

Posted by Karim Zaki <Ka...@itworx.com>.
This is exactly what is in place right now. I've written a filter in Tomcat to set the "Expires" header, and Apache honors it. However, when a page changes, I don't want to have to wait 24 hours for that change to reflect in the cache, and I don't want to have to clear the whole cache either. I want to selectively "push" the change to the cache by clearing that specific page from the apache cache so that the next time it is requested, it will be regenerated with the new content and cached.

-----Original Message-----
From: André Warnier [mailto:aw@ice-sa.com]
Sent: Monday, December 01, 2008 1:36 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache

I guess it all depends on your definition of "dynamic", and how you
handle this at the source.

When your Tomcat generates an answer page, it can add HTTP headers that
indicate for how long this content is valid.  If it doesn't, then by
default this means that the page is effectively "dynamic" (meaning that
each request could theoretically return a different answer next time).
What I mean by this, is that if your Tomcat added the right "Expires"
header in the first place (saying 24 hours), then you would have what
you seem to want, without having to do anything special in addition.
I would expect mod_cache at the Apache level, to take this information
into account, and serve the local copy instead of asking Tomcat again,
at least during these 24 hours. Then, when mod_cache realises that the
page's "valid until" date has passed, it will request a new version from
Tomcat automatically.

So, is there any particular reason why the above scheme is not
applicable in your case ?


Karim Zaki wrote:
> But that would be like re-implementing mod_cache, wouldn't it? Apache is already doing this for me. It's caching the dynamic content, keeping it for 24 hours, and checking if it's in cache before requesting it from the back-end server. The only problem is that I need to sometimes clear certain pages from cache.
>
> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com]
> Sent: Monday, December 01, 2008 1:00 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
>
> Karim Zaki wrote:
>> Greetings all,
>>
>> I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?
>>
> Hi.
> I am not going to answer your original question, but I just have a
> couple of remarks based on your description above, and maybe a different
> way of thinking about this.
>
> You say that you want to cache dynamic content generated by Tomcat, for
> 24 hours.
> In other words, it is not really dynamic content, because for 24 hours
> your users are going to get the same unique version.
>
> If so, then why would you not generate these pages in advance, and put
> them somewhere on your Apache server to be served as static content ?
> Then each 24 hours you can do the same and refresh them from Tomcat.
> (This would be fairly simple to do using a script, calling something
> like wget or curl, or in perl using LWP).
>
> I believe it is fairly simple to configure your Apache in such a way
> that it will look first of this URL is available as a static page, and
> if not forward the call to Tomcat.
> (using mod_rewrite e.g.).
>
>
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
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] Clearing cache selectively on Apache + mod_cache

Posted by André Warnier <aw...@ice-sa.com>.
I guess it all depends on your definition of "dynamic", and how you 
handle this at the source.

When your Tomcat generates an answer page, it can add HTTP headers that 
indicate for how long this content is valid.  If it doesn't, then by 
default this means that the page is effectively "dynamic" (meaning that 
each request could theoretically return a different answer next time).
What I mean by this, is that if your Tomcat added the right "Expires" 
header in the first place (saying 24 hours), then you would have what 
you seem to want, without having to do anything special in addition.
I would expect mod_cache at the Apache level, to take this information 
into account, and serve the local copy instead of asking Tomcat again, 
at least during these 24 hours. Then, when mod_cache realises that the 
page's "valid until" date has passed, it will request a new version from 
Tomcat automatically.

So, is there any particular reason why the above scheme is not 
applicable in your case ?


Karim Zaki wrote:
> But that would be like re-implementing mod_cache, wouldn't it? Apache is already doing this for me. It's caching the dynamic content, keeping it for 24 hours, and checking if it's in cache before requesting it from the back-end server. The only problem is that I need to sometimes clear certain pages from cache.
> 
> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com]
> Sent: Monday, December 01, 2008 1:00 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache
> 
> Karim Zaki wrote:
>> Greetings all,
>>
>> I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?
>>
> Hi.
> I am not going to answer your original question, but I just have a
> couple of remarks based on your description above, and maybe a different
> way of thinking about this.
> 
> You say that you want to cache dynamic content generated by Tomcat, for
> 24 hours.
> In other words, it is not really dynamic content, because for 24 hours
> your users are going to get the same unique version.
> 
> If so, then why would you not generate these pages in advance, and put
> them somewhere on your Apache server to be served as static content ?
> Then each 24 hours you can do the same and refresh them from Tomcat.
> (This would be fairly simple to do using a script, calling something
> like wget or curl, or in perl using LWP).
> 
> I believe it is fairly simple to configure your Apache in such a way
> that it will look first of this URL is available as a static page, and
> if not forward the call to Tomcat.
> (using mod_rewrite e.g.).
> 
> 
> ---------------------------------------------------------------------
> 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] Clearing cache selectively on Apache + mod_cache

Posted by Karim Zaki <Ka...@itworx.com>.
But that would be like re-implementing mod_cache, wouldn't it? Apache is already doing this for me. It's caching the dynamic content, keeping it for 24 hours, and checking if it's in cache before requesting it from the back-end server. The only problem is that I need to sometimes clear certain pages from cache.

-----Original Message-----
From: André Warnier [mailto:aw@ice-sa.com]
Sent: Monday, December 01, 2008 1:00 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache

Karim Zaki wrote:
> Greetings all,
>
> I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?
>
Hi.
I am not going to answer your original question, but I just have a
couple of remarks based on your description above, and maybe a different
way of thinking about this.

You say that you want to cache dynamic content generated by Tomcat, for
24 hours.
In other words, it is not really dynamic content, because for 24 hours
your users are going to get the same unique version.

If so, then why would you not generate these pages in advance, and put
them somewhere on your Apache server to be served as static content ?
Then each 24 hours you can do the same and refresh them from Tomcat.
(This would be fairly simple to do using a script, calling something
like wget or curl, or in perl using LWP).

I believe it is fairly simple to configure your Apache in such a way
that it will look first of this URL is available as a static page, and
if not forward the call to Tomcat.
(using mod_rewrite e.g.).


---------------------------------------------------------------------
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] Clearing cache selectively on Apache + mod_cache

Posted by André Warnier <aw...@ice-sa.com>.
Karim Zaki wrote:
> Greetings all,
> 
> I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?
> 
Hi.
I am not going to answer your original question, but I just have a 
couple of remarks based on your description above, and maybe a different 
way of thinking about this.

You say that you want to cache dynamic content generated by Tomcat, for 
24 hours.
In other words, it is not really dynamic content, because for 24 hours 
your users are going to get the same unique version.

If so, then why would you not generate these pages in advance, and put 
them somewhere on your Apache server to be served as static content ?
Then each 24 hours you can do the same and refresh them from Tomcat.
(This would be fairly simple to do using a script, calling something 
like wget or curl, or in perl using LWP).

I believe it is fairly simple to configure your Apache in such a way 
that it will look first of this URL is available as a static page, and 
if not forward the call to Tomcat.
(using mod_rewrite e.g.).


---------------------------------------------------------------------
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] RE: Clearing cache selectively on Apache + mod_cache

Posted by Karim Zaki <Ka...@itworx.com>.
Will do

-----Original Message-----
From: Tamer Embaby [mailto:Tamer.Embaby@itworx.com]
Sent: Monday, December 01, 2008 5:49 PM
To: users@httpd.apache.org
Subject: RE: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

Karim,

Please let me know if it works for you.

Tamer

-----Original Message-----
From: Karim Zaki [mailto:Karim.Zaki@itworx.com]
Sent: Monday, December 01, 2008 3:58 PM
To: users@httpd.apache.org
Subject: RE: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

Yeah in this instance there are 2 interfaces on the box. I'll use the internal interface, which is not accessible from the Internet anyway...so

<VirtualHost internal-ip>
CacheIgnoreCacheControl Off
</VirtualHost>

Let's see how that works.

-----Original Message-----
From: Eric Covener [mailto:covener@gmail.com]
Sent: Monday, December 01, 2008 3:50 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

On Mon, Dec 1, 2008 at 8:42 AM, Tamer Embaby <Ta...@itworx.com> wrote:
> Eric,
>
> So using 2 vhosts would be:
>
> # External vhost
> <VirtualHost *:80>
>        ServerName www.example.com
>        CacheRoot /path/to/cache
>        Cache disk /url
>        CacheIgnoreCacheControl On
>        CacheMaxExpire 86400
>        CacheDefaultExpire 86400
> </VirtualHost>
>
> # Internal vhost
> <VirtualHost *:80>
>        ServerName cache-internal.example.com
>        CacheRoot /path/to/cache
>        Cache disk /url
>        CacheMaxExpire 86400
>        CacheDefaultExpire 86400
> </VirtualHost>
>
> And then when requiring a "push" when the content changes we access
> the internal http://cache-internal.example.com/url/path/to/invalidate
> with "Cache-Control" HTTP header set to "max-age=0,must-revalidate"?

Yes, with the caveat some might prefer to have it only respond on a
different interface (even though I said name vhost before) or maybe
even require authentication of some kind.

--
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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


---------------------------------------------------------------------
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] RE: Clearing cache selectively on Apache + mod_cache

Posted by Tamer Embaby <Ta...@itworx.com>.
Karim,

Please let me know if it works for you.

Tamer

-----Original Message-----
From: Karim Zaki [mailto:Karim.Zaki@itworx.com]
Sent: Monday, December 01, 2008 3:58 PM
To: users@httpd.apache.org
Subject: RE: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

Yeah in this instance there are 2 interfaces on the box. I'll use the internal interface, which is not accessible from the Internet anyway...so

<VirtualHost internal-ip>
CacheIgnoreCacheControl Off
</VirtualHost>

Let's see how that works.

-----Original Message-----
From: Eric Covener [mailto:covener@gmail.com]
Sent: Monday, December 01, 2008 3:50 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

On Mon, Dec 1, 2008 at 8:42 AM, Tamer Embaby <Ta...@itworx.com> wrote:
> Eric,
>
> So using 2 vhosts would be:
>
> # External vhost
> <VirtualHost *:80>
>        ServerName www.example.com
>        CacheRoot /path/to/cache
>        Cache disk /url
>        CacheIgnoreCacheControl On
>        CacheMaxExpire 86400
>        CacheDefaultExpire 86400
> </VirtualHost>
>
> # Internal vhost
> <VirtualHost *:80>
>        ServerName cache-internal.example.com
>        CacheRoot /path/to/cache
>        Cache disk /url
>        CacheMaxExpire 86400
>        CacheDefaultExpire 86400
> </VirtualHost>
>
> And then when requiring a "push" when the content changes we access
> the internal http://cache-internal.example.com/url/path/to/invalidate
> with "Cache-Control" HTTP header set to "max-age=0,must-revalidate"?

Yes, with the caveat some might prefer to have it only respond on a
different interface (even though I said name vhost before) or maybe
even require authentication of some kind.

--
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] RE: Clearing cache selectively on Apache + mod_cache

Posted by Karim Zaki <Ka...@itworx.com>.
Yeah in this instance there are 2 interfaces on the box. I'll use the internal interface, which is not accessible from the Internet anyway...so

<VirtualHost internal-ip>
CacheIgnoreCacheControl Off
</VirtualHost>

Let's see how that works.

-----Original Message-----
From: Eric Covener [mailto:covener@gmail.com]
Sent: Monday, December 01, 2008 3:50 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

On Mon, Dec 1, 2008 at 8:42 AM, Tamer Embaby <Ta...@itworx.com> wrote:
> Eric,
>
> So using 2 vhosts would be:
>
> # External vhost
> <VirtualHost *:80>
>        ServerName www.example.com
>        CacheRoot /path/to/cache
>        Cache disk /url
>        CacheIgnoreCacheControl On
>        CacheMaxExpire 86400
>        CacheDefaultExpire 86400
> </VirtualHost>
>
> # Internal vhost
> <VirtualHost *:80>
>        ServerName cache-internal.example.com
>        CacheRoot /path/to/cache
>        Cache disk /url
>        CacheMaxExpire 86400
>        CacheDefaultExpire 86400
> </VirtualHost>
>
> And then when requiring a "push" when the content changes we access
> the internal http://cache-internal.example.com/url/path/to/invalidate
> with "Cache-Control" HTTP header set to "max-age=0,must-revalidate"?

Yes, with the caveat some might prefer to have it only respond on a
different interface (even though I said name vhost before) or maybe
even require authentication of some kind.

--
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] RE: Clearing cache selectively on Apache + mod_cache

Posted by Eric Covener <co...@gmail.com>.
On Mon, Dec 1, 2008 at 8:42 AM, Tamer Embaby <Ta...@itworx.com> wrote:
> Eric,
>
> So using 2 vhosts would be:
>
> # External vhost
> <VirtualHost *:80>
>        ServerName www.example.com
>        CacheRoot /path/to/cache
>        Cache disk /url
>        CacheIgnoreCacheControl On
>        CacheMaxExpire 86400
>        CacheDefaultExpire 86400
> </VirtualHost>
>
> # Internal vhost
> <VirtualHost *:80>
>        ServerName cache-internal.example.com
>        CacheRoot /path/to/cache
>        Cache disk /url
>        CacheMaxExpire 86400
>        CacheDefaultExpire 86400
> </VirtualHost>
>
> And then when requiring a "push" when the content changes we access
> the internal http://cache-internal.example.com/url/path/to/invalidate
> with "Cache-Control" HTTP header set to "max-age=0,must-revalidate"?

Yes, with the caveat some might prefer to have it only respond on a
different interface (even though I said name vhost before) or maybe
even require authentication of some kind.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] RE: Clearing cache selectively on Apache + mod_cache

Posted by Tamer Embaby <Ta...@itworx.com>.
Eric,

So using 2 vhosts would be:

# External vhost
<VirtualHost *:80>
        ServerName www.example.com
        CacheRoot /path/to/cache
        Cache disk /url
        CacheIgnoreCacheControl On
        CacheMaxExpire 86400
        CacheDefaultExpire 86400
</VirtualHost>

# Internal vhost
<VirtualHost *:80>
        ServerName cache-internal.example.com
        CacheRoot /path/to/cache
        Cache disk /url
        CacheMaxExpire 86400
        CacheDefaultExpire 86400
</VirtualHost>

And then when requiring a "push" when the content changes we access
the internal http://cache-internal.example.com/url/path/to/invalidate
with "Cache-Control" HTTP header set to "max-age=0,must-revalidate"?

And that would eliminate the little backdoor you were talking about,
Karim?

Regards,
Tamer

-----Original Message-----
From: Eric Covener [mailto:covener@gmail.com]
Sent: Monday, December 01, 2008 3:22 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

On Mon, Dec 1, 2008 at 8:00 AM, Karim Zaki <Ka...@itworx.com> wrote:
> That sounds like a great idea, but how do I configure mod_cache differently for the vhost? Would I configure it within the vhost scope? If so, that configuration would need to point to the same cache store, but without the CacheIgnoreCacheControl, right?

CacheIgnoreCacheControl works in vhost context.

--
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] RE: Clearing cache selectively on Apache + mod_cache

Posted by Eric Covener <co...@gmail.com>.
On Mon, Dec 1, 2008 at 8:00 AM, Karim Zaki <Ka...@itworx.com> wrote:
> That sounds like a great idea, but how do I configure mod_cache differently for the vhost? Would I configure it within the vhost scope? If so, that configuration would need to point to the same cache store, but without the CacheIgnoreCacheControl, right?

CacheIgnoreCacheControl works in vhost context.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] RE: Clearing cache selectively on Apache + mod_cache

Posted by Karim Zaki <Ka...@itworx.com>.
That sounds like a great idea, but how do I configure mod_cache differently for the vhost? Would I configure it within the vhost scope? If so, that configuration would need to point to the same cache store, but without the CacheIgnoreCacheControl, right?

-----Original Message-----
From: Eric Covener [mailto:covener@gmail.com]
Sent: Monday, December 01, 2008 2:54 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

On Mon, Dec 1, 2008 at 7:46 AM, Karim Zaki <Ka...@itworx.com> wrote:
> So the CacheIgnoreCacheControl directive ignores "max-age" as well as
> "no-cache"? I've seen some stuff online that suggested that it honors
> "max-age=0", but not "no-cache"...which would provide a nice little backdoor.

you might consider a vhost serving some internal interface only, that
does not have the CacheIgnoreCacheControl.

--
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] RE: Clearing cache selectively on Apache + mod_cache

Posted by Eric Covener <co...@gmail.com>.
On Mon, Dec 1, 2008 at 7:46 AM, Karim Zaki <Ka...@itworx.com> wrote:
> So the CacheIgnoreCacheControl directive ignores "max-age" as well as
> "no-cache"? I've seen some stuff online that suggested that it honors
> "max-age=0", but not "no-cache"…which would provide a nice little backdoor.

you might consider a vhost serving some internal interface only, that
does not have the CacheIgnoreCacheControl.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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


[users@httpd] RE: Clearing cache selectively on Apache + mod_cache

Posted by Karim Zaki <Ka...@itworx.com>.
So the CacheIgnoreCacheControl directive ignores "max-age" as well as "no-cache"? I've seen some stuff online that suggested that it honors "max-age=0", but not "no-cache"...which would provide a nice little backdoor.

From: Tamer Embaby [mailto:Tamer.Embaby@itworx.com]
Sent: Monday, December 01, 2008 1:48 PM
To: users@httpd.apache.org
Subject: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

Karim,

Because we instructed mod_cache to ignore CacheControl headers as
well, it's the same as your case.

Tamer

________________________________
From: Karim Zaki [mailto:Karim.Zaki@itworx.com]
Sent: Monday, December 01, 2008 12:36 PM
To: users@httpd.apache.org
Subject: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

Why do you think using request headers would not work?

From: Tamer Embaby [mailto:Tamer.Embaby@itworx.com]
Sent: Monday, December 01, 2008 1:39 AM
To: users@httpd.apache.org
Subject: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

Karim,

I'm afraid you have to do that programmatically.  We've done that in a
project before with Apache 2.0 by knowing how Apache encodes
URL for storing in internal cache directories, read it from:
modules/cache_util.c:
          cache_hash(...)

Which is controlled using:
      CacheDirLevels XX
      CacheDirLength YY
Apache directives.

I believe you will write your own code that hashes the target URL like
Apache does, and delete that file from the cache, call that code
whenever you need to content is updated.

And I don't think that would change for 2.2.X Apache, the addition of
"htcacheclean" doesn't help in your case either.

P.S. Look for Hossam Karim if you need the Java code, he is the one
who did that.

Regards,
Tamer

________________________________
From: Karim Zaki [mailto:Karim.Zaki@itworx.com]
Sent: Sunday, November 30, 2008 4:59 PM
To: users@httpd.apache.org
Subject: [users@httpd] Clearing cache selectively on Apache + mod_cache

Greetings all,

I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?

Thanks,
Karim

-------------------------------------------------------------------------------
"Although the moon is smaller than the earth, it is farther away."


[users@httpd] RE: Clearing cache selectively on Apache + mod_cache

Posted by Tamer Embaby <Ta...@itworx.com>.
Karim,

Because we instructed mod_cache to ignore CacheControl headers as
well, it's the same as your case.

Tamer

________________________________
From: Karim Zaki [mailto:Karim.Zaki@itworx.com]
Sent: Monday, December 01, 2008 12:36 PM
To: users@httpd.apache.org
Subject: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

Why do you think using request headers would not work?

From: Tamer Embaby [mailto:Tamer.Embaby@itworx.com]
Sent: Monday, December 01, 2008 1:39 AM
To: users@httpd.apache.org
Subject: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

Karim,

I'm afraid you have to do that programmatically.  We've done that in a
project before with Apache 2.0 by knowing how Apache encodes
URL for storing in internal cache directories, read it from:
modules/cache_util.c:
          cache_hash(...)

Which is controlled using:
      CacheDirLevels XX
      CacheDirLength YY
Apache directives.

I believe you will write your own code that hashes the target URL like
Apache does, and delete that file from the cache, call that code
whenever you need to content is updated.

And I don't think that would change for 2.2.X Apache, the addition of
"htcacheclean" doesn't help in your case either.

P.S. Look for Hossam Karim if you need the Java code, he is the one
who did that.

Regards,
Tamer

________________________________
From: Karim Zaki [mailto:Karim.Zaki@itworx.com]
Sent: Sunday, November 30, 2008 4:59 PM
To: users@httpd.apache.org
Subject: [users@httpd] Clearing cache selectively on Apache + mod_cache

Greetings all,

I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?

Thanks,
Karim

-------------------------------------------------------------------------------
"Although the moon is smaller than the earth, it is farther away."


[users@httpd] RE: Clearing cache selectively on Apache + mod_cache

Posted by Karim Zaki <Ka...@itworx.com>.
Why do you think using request headers would not work?

From: Tamer Embaby [mailto:Tamer.Embaby@itworx.com]
Sent: Monday, December 01, 2008 1:39 AM
To: users@httpd.apache.org
Subject: [users@httpd] RE: Clearing cache selectively on Apache + mod_cache

Karim,

I'm afraid you have to do that programmatically.  We've done that in a
project before with Apache 2.0 by knowing how Apache encodes
URL for storing in internal cache directories, read it from:
modules/cache_util.c:
          cache_hash(...)

Which is controlled using:
      CacheDirLevels XX
      CacheDirLength YY
Apache directives.

I believe you will write your own code that hashes the target URL like
Apache does, and delete that file from the cache, call that code
whenever you need to content is updated.

And I don't think that would change for 2.2.X Apache, the addition of
"htcacheclean" doesn't help in your case either.

P.S. Look for Hossam Karim if you need the Java code, he is the one
who did that.

Regards,
Tamer

________________________________
From: Karim Zaki [mailto:Karim.Zaki@itworx.com]
Sent: Sunday, November 30, 2008 4:59 PM
To: users@httpd.apache.org
Subject: [users@httpd] Clearing cache selectively on Apache + mod_cache

Greetings all,

I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?

Thanks,
Karim

-------------------------------------------------------------------------------
"Although the moon is smaller than the earth, it is farther away."


[users@httpd] RE: Clearing cache selectively on Apache + mod_cache

Posted by Tamer Embaby <Ta...@itworx.com>.
Karim,

I'm afraid you have to do that programmatically.  We've done that in a
project before with Apache 2.0 by knowing how Apache encodes
URL for storing in internal cache directories, read it from:
modules/cache_util.c:
          cache_hash(...)

Which is controlled using:
      CacheDirLevels XX
      CacheDirLength YY
Apache directives.

I believe you will write your own code that hashes the target URL like
Apache does, and delete that file from the cache, call that code
whenever you need to content is updated.

And I don't think that would change for 2.2.X Apache, the addition of
"htcacheclean" doesn't help in your case either.

P.S. Look for Hossam Karim if you need the Java code, he is the one
who did that.

Regards,
Tamer

________________________________
From: Karim Zaki [mailto:Karim.Zaki@itworx.com]
Sent: Sunday, November 30, 2008 4:59 PM
To: users@httpd.apache.org
Subject: [users@httpd] Clearing cache selectively on Apache + mod_cache

Greetings all,

I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for a way to clear the cache from Apache for specific URLs. I'm using Apache to cache dynamic content that is served by Tomcat, and I would like to keep the content (age) high (e.g. 24 hours) but still to be able to clear the cache for specific pages when the content is updated. Is there a way to tell Apache to clear the cache for a specific list of URLs?

Thanks,
Karim

-------------------------------------------------------------------------------
"Although the moon is smaller than the earth, it is farther away."


RE: [users@httpd] Clearing cache selectively on Apache + mod_cache

Posted by Karim Zaki <Ka...@itworx.com>.
That sounds like a possible way to go. However, this spills into another question. I have the CacheIgnoreCacheControl directive set to "On" for mod_cache. I know that this means "no-cache" is ignored in the request. Does it also ignore "max-age", or can I force the cache to clear by using "max-age" even if CacheIgnoreCacheControl is on?

Thanks,

-----Original Message-----
From: Eric Covener [mailto:covener@gmail.com]
Sent: Monday, December 01, 2008 2:19 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Clearing cache selectively on Apache + mod_cache

On Sun, Nov 30, 2008 at 9:59 AM, Karim Zaki <Ka...@itworx.com> wrote:
> Greetings all,
>
>
>
> I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for
> a way to clear the cache from Apache for specific URLs. I'm using Apache to
> cache dynamic content that is served by Tomcat, and I would like to keep the
> content (age) high (e.g. 24 hours) but still to be able to clear the cache
> for specific pages when the content is updated. Is there a way to tell
> Apache to clear the cache for a specific list of URLs?
>

Try these combinations of headers, comment from cache_util.c:

    /*
     * We now want to check if our cached data is still fresh. This depends
     * on a few things, in this order:
     *
     * - RFC2616 14.9.4 End to end reload, Cache-Control: no-cache. no-cache in
     * either the request or the cached response means that we must
     * revalidate the request unconditionally, overriding any expiration
     * mechanism. It's equivalent to max-age=0,must-revalidate.
     *



--
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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] Clearing cache selectively on Apache + mod_cache

Posted by Eric Covener <co...@gmail.com>.
On Sun, Nov 30, 2008 at 9:59 AM, Karim Zaki <Ka...@itworx.com> wrote:
> Greetings all,
>
>
>
> I'm running Apache/2.2.10 (Win32) mod_jk/1.2.27 + mod_cache. I'm looking for
> a way to clear the cache from Apache for specific URLs. I'm using Apache to
> cache dynamic content that is served by Tomcat, and I would like to keep the
> content (age) high (e.g. 24 hours) but still to be able to clear the cache
> for specific pages when the content is updated. Is there a way to tell
> Apache to clear the cache for a specific list of URLs?
>

Try these combinations of headers, comment from cache_util.c:

    /*
     * We now want to check if our cached data is still fresh. This depends
     * on a few things, in this order:
     *
     * - RFC2616 14.9.4 End to end reload, Cache-Control: no-cache. no-cache in
     * either the request or the cached response means that we must
     * revalidate the request unconditionally, overriding any expiration
     * mechanism. It's equivalent to max-age=0,must-revalidate.
     *



-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
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