From de8942eb9f1c05aabf2a7061659a20edd7e9dba9 Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Sat, 9 Mar 2002 06:59:28 +0000 Subject: [PATCH] Scrap CacheMaxExpireMin and CacheDefaultExpireMin. Change CacheMaxExpire and CacheDefaultExpire to use seconds rather than hours. PR: Obtained from: Submitted by: Reviewed by: Bill Stoddard git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93810 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 +++ modules/experimental/mod_cache.c | 45 +++----------------------------- modules/experimental/mod_cache.h | 9 ++++--- 3 files changed, 13 insertions(+), 45 deletions(-) diff --git a/CHANGES b/CHANGES index 30e848a5ff..97a1aa6c53 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 2.0.34-dev + *) Scrap CacheMaxExpireMin and CacheDefaultExpireMin. Change + CacheMaxExpire and CacheDefaultExpire to use seconds rather than + hours. [Graham Leggett, Bill Stoddard] + *) New Directive SSIUndefinedEcho. to change the '(none)' echoed for a undefined variable. [Ian Holsman] diff --git a/modules/experimental/mod_cache.c b/modules/experimental/mod_cache.c index c68024b0f8..c47f4272c9 100644 --- a/modules/experimental/mod_cache.c +++ b/modules/experimental/mod_cache.c @@ -861,24 +861,8 @@ static const char { cache_server_conf *conf = ap_get_module_config(parms->server->module_config, &cache_module); - double val; - - if (sscanf(arg, "%lg", &val) != 1) - return "CacheMaxExpire value must be a float"; - conf->maxex = (apr_time_t) (val * MSEC_ONE_HR); - conf->maxex_set = 1; - return NULL; -} -static const char -*set_cache_maxex_min(cmd_parms *parms, void *dummy, const char *arg) -{ - cache_server_conf *conf = ap_get_module_config(parms->server->module_config, - &cache_module); - long val; - - val = atol(arg); - conf->maxex = (apr_time_t) (val * MSEC_ONE_MIN); + conf->maxex = (apr_time_t) (atol(arg) * MSEC_ONE_SEC); conf->maxex_set = 1; return NULL; } @@ -888,24 +872,8 @@ static const char { cache_server_conf *conf = ap_get_module_config(parms->server->module_config, &cache_module); - double val; - if (sscanf(arg, "%lg", &val) != 1) - return "CacheDefaultExpire value must be a float"; - conf->defex = (apr_time_t) (val * MSEC_ONE_HR); - conf->defex_set = 1; - return NULL; -} -static const char -*set_cache_defex_min(cmd_parms *parms, void *dummy, const char *arg) -{ - cache_server_conf *conf = ap_get_module_config(parms->server->module_config, - &cache_module); - long val; - - val = atol(arg); - - conf->defex = (apr_time_t) (val * MSEC_ONE_MIN); + conf->defex = (apr_time_t) (atol(arg) * MSEC_ONE_SEC); conf->defex_set = 1; return NULL; } @@ -968,14 +936,9 @@ static const command_rec cache_cmds[] = AP_INIT_TAKE1("CacheDisable", add_cache_disable, NULL, RSRC_CONF, "A partial URL prefix below which caching is disabled"), AP_INIT_TAKE1("CacheMaxExpire", set_cache_maxex, NULL, RSRC_CONF, - "The maximum time in hours to cache a document"), - AP_INIT_TAKE1("CacheMaxExpireMin", set_cache_maxex_min, NULL, RSRC_CONF, - "The maximum time in Minutes to cache a document"), - + "The maximum time in seconds to cache a document"), AP_INIT_TAKE1("CacheDefaultExpire", set_cache_defex, NULL, RSRC_CONF, - "The default time in hours to cache a document"), - AP_INIT_TAKE1("CacheDefaultExpireMin", set_cache_defex_min, NULL, RSRC_CONF, - "The default time in Minutes to cache a document"), + "The default time in seconds to cache a document"), AP_INIT_FLAG("CacheIgnoreNoLastMod", set_cache_ignore_no_last_mod, NULL, RSRC_CONF, "Ignore Responses where there is no Last Modified Header"), diff --git a/modules/experimental/mod_cache.h b/modules/experimental/mod_cache.h index b129c2e337..37cc0e5057 100644 --- a/modules/experimental/mod_cache.h +++ b/modules/experimental/mod_cache.h @@ -118,12 +118,13 @@ /* default completion is 60% */ #define DEFAULT_CACHE_COMPLETION (60) #define MAX_URL_LENGTH 1024 -#define MSEC_ONE_DAY ((apr_time_t)(86400*APR_USEC_PER_SEC)) /* one day, in microseconds */ -#define MSEC_ONE_HR ((apr_time_t)(3600*APR_USEC_PER_SEC)) /* one hour, in microseconds */ -#define MSEC_ONE_MIN ((apr_time_t)(60*APR_USEC_PER_SEC)) /* one minute, in microseconds */ +#define MSEC_ONE_DAY ((apr_time_t)(86400*APR_USEC_PER_SEC)) /* one day, in microseconds */ +#define MSEC_ONE_HR ((apr_time_t)(3600*APR_USEC_PER_SEC)) /* one hour, in microseconds */ +#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_EXPIRE MSEC_ONE_HR -#define DEFAULT_CACHE_LMFACTOR (0.1) +#define DEFAULT_CACHE_LMFACTOR (0.1) /* Create a set of PROXY_DECLARE(type), PROXY_DECLARE_NONSTD(type) and * PROXY_DECLARE_DATA with appropriate export and import tags for the platform -- 2.40.0