You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2006/01/17 16:12:29 UTC
svn commit: r369811 - in /httpd/httpd/trunk: CHANGES
docs/manual/mod/mod_cache.xml modules/cache/mod_cache.c
modules/cache/mod_cache.h
Author: rpluem
Date: Tue Jan 17 07:12:23 2006
New Revision: 369811
URL: http://svn.apache.org/viewcvs?rev=369811&view=rev
Log:
* Add CacheMinExpire directive to set the minimum time in seconds to cache a document
in the case that no valid expire time was supplied with the document.
Submitted by: Brian Akins <brian.akins turner.com>
Reviewed by: Ruediger Pluem
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/docs/manual/mod/mod_cache.xml
httpd/httpd/trunk/modules/cache/mod_cache.c
httpd/httpd/trunk/modules/cache/mod_cache.h
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/CHANGES?rev=369811&r1=369810&r2=369811&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue Jan 17 07:12:23 2006
@@ -2,6 +2,10 @@
Changes with Apache 2.3.0
[Remove entries to the current 2.0 and 2.2 section below, when backported]
+ *) mod_cache: Add CacheMinExpire directive to set the minimum time in
+ seconds to cache a document.
+ [Brian Akins <brian.akins turner.com>, Ruediger Pluem]
+
*) mod_cache: Make caching of reverse proxies possible again. PR 38017.
[Ruediger Pluem]
Modified: httpd/httpd/trunk/docs/manual/mod/mod_cache.xml
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/docs/manual/mod/mod_cache.xml?rev=369811&r1=369810&r2=369811&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_cache.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_cache.xml Tue Jan 17 07:12:23 2006
@@ -212,6 +212,26 @@
</directivesynopsis>
<directivesynopsis>
+<name>CacheMinExpire</name>
+<description>The minimum time in seconds to cache a document</description>
+<syntax>CacheMinExpire <var>seconds</var></syntax>
+<default>CacheMinExpire 0</default>
+<contextlist><context>server config</context><context>virtual host</context>
+</contextlist>
+
+<usage>
+ <p>The <directive>CacheMinExpire</directive> directive specifies the minimum number of
+ seconds for which cachable HTTP documents will be retained without checking the origin
+ server. This is only used if no valid expire time was supplied with the document.</p>
+
+
+ <example>
+ CacheMinExpire 3600
+ </example>
+</usage>
+</directivesynopsis>
+
+<directivesynopsis>
<name>CacheDefaultExpire</name>
<description>The default duration to cache a document when no expiry date is specified.</description>
<syntax>CacheDefaultExpire <var>seconds</var></syntax>
Modified: httpd/httpd/trunk/modules/cache/mod_cache.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/cache/mod_cache.c?rev=369811&r1=369810&r2=369811&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_cache.c Tue Jan 17 07:12:23 2006
@@ -689,6 +689,9 @@
if ((lastmod != APR_DATE_BAD) && (lastmod < date)) {
apr_time_t x = (apr_time_t) ((date - lastmod) * conf->factor);
+ if (x < conf->minex) {
+ x = conf->minex;
+ }
if (x > conf->maxex) {
x = conf->maxex;
}
@@ -872,6 +875,8 @@
/* maximum time to cache a document */
ps->maxex = DEFAULT_CACHE_MAXEXPIRE;
ps->maxex_set = 0;
+ ps->minex = DEFAULT_CACHE_MINEXPIRE;
+ ps->minex_set = 0;
/* default time to cache a document */
ps->defex = DEFAULT_CACHE_EXPIRE;
ps->defex_set = 0;
@@ -908,6 +913,7 @@
overrides->cacheenable);
/* maximum time to cache a document */
ps->maxex = (overrides->maxex_set == 0) ? base->maxex : overrides->maxex;
+ ps->minex = (overrides->minex_set == 0) ? base->minex : overrides->minex;
/* default time to cache a document */
ps->defex = (overrides->defex_set == 0) ? base->defex : overrides->defex;
/* factor used to estimate Expires date from LastModified date */
@@ -1082,6 +1088,19 @@
return NULL;
}
+static const char *set_cache_minex(cmd_parms *parms, void *dummy,
+ const char *arg)
+{
+ cache_server_conf *conf;
+
+ conf =
+ (cache_server_conf *)ap_get_module_config(parms->server->module_config,
+ &cache_module);
+ conf->minex = (apr_time_t) (atol(arg) * MSEC_ONE_SEC);
+ conf->minex_set = 1;
+ return NULL;
+}
+
static const char *set_cache_defex(cmd_parms *parms, void *dummy,
const char *arg)
{
@@ -1144,6 +1163,8 @@
"A partial URL prefix below which caching is disabled"),
AP_INIT_TAKE1("CacheMaxExpire", set_cache_maxex, NULL, RSRC_CONF,
"The maximum time in seconds to cache a document"),
+ AP_INIT_TAKE1("CacheMinExpire", set_cache_minex, NULL, RSRC_CONF,
+ "The minimum time in seconds to cache a document"),
AP_INIT_TAKE1("CacheDefaultExpire", set_cache_defex, NULL, RSRC_CONF,
"The default time in seconds to cache a document"),
AP_INIT_FLAG("CacheIgnoreNoLastMod", set_cache_ignore_no_last_mod, NULL,
Modified: httpd/httpd/trunk/modules/cache/mod_cache.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/cache/mod_cache.h?rev=369811&r1=369810&r2=369811&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_cache.h (original)
+++ httpd/httpd/trunk/modules/cache/mod_cache.h Tue Jan 17 07:12:23 2006
@@ -84,6 +84,7 @@
#define MSEC_ONE_MIN ((apr_time_t)(60*APR_USEC_PER_SEC)) /* one minute, in microseconds */
#define MSEC_ONE_SEC ((apr_time_t)(APR_USEC_PER_SEC)) /* one second, in microseconds */
#define DEFAULT_CACHE_MAXEXPIRE MSEC_ONE_DAY
+#define DEFAULT_CACHE_MINEXPIRE 0
#define DEFAULT_CACHE_EXPIRE MSEC_ONE_HR
#define DEFAULT_CACHE_LMFACTOR (0.1)
@@ -150,6 +151,9 @@
#define CACHE_IGNORE_HEADERS_SET 1
#define CACHE_IGNORE_HEADERS_UNSET 0
int ignore_headers_set;
+ /* Minimum time to keep cached files in msecs */
+ apr_time_t minex;
+ int minex_set;
} cache_server_conf;
/* cache info information */
Re: svn commit: r369811 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_cache.xml
modules/cache/mod_cache.c modules/cache/mod_cache.h
Posted by Ruediger Pluem <rp...@apache.org>.
On 01/17/2006 05:19 PM, Bill Stoddard wrote:
> Ruediger Pluem wrote:
[..cut..]
>>
>> Does this change require some sort of bump? And if yes what kind of?
>>
[..cut..]
>
>
> I was about to reply 'I don't think so' under the argument that
> cache_server_conf is not part of the Apache module API, it should only
> be referenced by the cache modules. However, I don't recall if the core
Makes sense, but what about 3rd party storage modules / providers for mod_cache?
Wouldn't they be affected by this?
Regards
Rüdiger
[..cut..]
Re: svn commit: r369811 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_cache.xml
modules/cache/mod_cache.c modules/cache/mod_cache.h
Posted by Ruediger Pluem <rp...@apache.org>.
On 01/17/2006 09:55 PM, William A. Rowe, Jr. wrote:
[..cut..]
> Yet third party modules may be using this. Since you wisely;
>
> @@ -150,6 +151,9 @@
> #define CACHE_IGNORE_HEADERS_SET 1
> #define CACHE_IGNORE_HEADERS_UNSET 0
> int ignore_headers_set;
> + /* Minimum time to keep cached files in msecs */
> + apr_time_t minex;
> + int minex_set;
> } cache_server_conf;
>
> dropped these at the end of the cache_server_conf, the bump is minor (the
Thanks for clarification. So this is what needs to be done, right (Just
asking because it is my first bump :-))?
Index: include/ap_mmn.h
===================================================================
--- include/ap_mmn.h (Revision 369902)
+++ include/ap_mmn.h (Arbeitskopie)
@@ -112,8 +112,10 @@
* 20051231.0 (2.3.0-dev) Added num_blank_lines, pending_header_line, and
* pending_header_size to request_rec
* 20060110.0 (2.3.0-dev) Conversion of Authz to be provider based
- addition of <SatisfyAll><SatisfyOne>
- removal of Satisfy, Allow, Deny, Order
+ * addition of <SatisfyAll><SatisfyOne>
+ * removal of Satisfy, Allow, Deny, Order
+ * 20060110.1 (2.3.0-dev) minex and minex_set members added to
+ * cache_server_conf (minor)
*/
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
@@ -121,7 +123,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20060110
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
Regards
Rüdiger
Re: svn commit: r369811 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_cache.xml
modules/cache/mod_cache.c modules/cache/mod_cache.h
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Brian Akins wrote:
> Bill Stoddard wrote:
>
>> However, I don't recall if the core server is dependent on knowing the
>> size of module conf structures (during merge operations for instance).
>
> I'm pretty sure not. the conf structures are just void *'s that are
> passed around. I change crap all the time in my dev environment and
> have never hit a snag.
Yet third party modules may be using this. Since you wisely;
@@ -150,6 +151,9 @@
#define CACHE_IGNORE_HEADERS_SET 1
#define CACHE_IGNORE_HEADERS_UNSET 0
int ignore_headers_set;
+ /* Minimum time to keep cached files in msecs */
+ apr_time_t minex;
+ int minex_set;
} cache_server_conf;
dropped these at the end of the cache_server_conf, the bump is minor (the
mod_cache compiled module allocates its structure itself, which is why the
owner module does the merges for its _conf structure.)
Re: svn commit: r369811 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_cache.xml
modules/cache/mod_cache.c modules/cache/mod_cache.h
Posted by Brian Akins <br...@turner.com>.
Bill Stoddard wrote:
>However, I don't recall if the core
> server is dependent on knowing the size of module conf structures
> (during merge operations for instance).
I'm pretty sure not. the conf structures are just void *'s that are
passed around. I change crap all the time in my dev environment and
have never hit a snag.
--
Brian Akins
Lead Systems Engineer
CNN Internet Technologies
Re: svn commit: r369811 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_cache.xml
modules/cache/mod_cache.c modules/cache/mod_cache.h
Posted by Bill Stoddard <bi...@wstoddard.com>.
Ruediger Pluem wrote:
>>
>>@@ -150,6 +151,9 @@
>> #define CACHE_IGNORE_HEADERS_SET 1
>> #define CACHE_IGNORE_HEADERS_UNSET 0
>> int ignore_headers_set;
>>+ /* Minimum time to keep cached files in msecs */
>>+ apr_time_t minex;
>>+ int minex_set;
>> } cache_server_conf;
>
>
> Does this change require some sort of bump? And if yes what kind of?
>
> Regards
>
> Rüdiger
I was about to reply 'I don't think so' under the argument that cache_server_conf is not part of the Apache
module API, it should only be referenced by the cache modules. However, I don't recall if the core server is
dependent on knowing the size of module conf structures (during merge operations for instance). I think not,
but I could be mistaken.
Bill
Re: svn commit: r369811 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_cache.xml
modules/cache/mod_cache.c modules/cache/mod_cache.h
Posted by Ruediger Pluem <rp...@apache.org>.
On 01/17/2006 04:12 PM, rpluem@apache.org wrote:
[..cut..]
>
> ==============================================================================
> --- httpd/httpd/trunk/modules/cache/mod_cache.h (original)
> +++ httpd/httpd/trunk/modules/cache/mod_cache.h Tue Jan 17 07:12:23 2006
> @@ -84,6 +84,7 @@
> #define MSEC_ONE_MIN ((apr_time_t)(60*APR_USEC_PER_SEC)) /* one minute, in microseconds */
> #define MSEC_ONE_SEC ((apr_time_t)(APR_USEC_PER_SEC)) /* one second, in microseconds */
> #define DEFAULT_CACHE_MAXEXPIRE MSEC_ONE_DAY
> +#define DEFAULT_CACHE_MINEXPIRE 0
> #define DEFAULT_CACHE_EXPIRE MSEC_ONE_HR
> #define DEFAULT_CACHE_LMFACTOR (0.1)
>
> @@ -150,6 +151,9 @@
> #define CACHE_IGNORE_HEADERS_SET 1
> #define CACHE_IGNORE_HEADERS_UNSET 0
> int ignore_headers_set;
> + /* Minimum time to keep cached files in msecs */
> + apr_time_t minex;
> + int minex_set;
> } cache_server_conf;
Does this change require some sort of bump? And if yes what kind of?
Regards
Rüdiger