/*
- * $Id: cache_cf.cc,v 1.294 1998/07/31 00:15:35 wessels Exp $
+ * $Id: cache_cf.cc,v 1.295 1998/08/17 21:27:30 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
dump_refreshpattern(StoreEntry * entry, const char *name, refresh_t * head)
{
while (head != NULL) {
- storeAppendPrintf(entry, "%s%s %s %d %d%% %d\n",
+ storeAppendPrintf(entry, "%s%s %s %d %d%% %d%s%s\n",
name,
head->flags.icase ? " -i" : null_string,
head->pattern,
(int) head->min / 60,
(int) (100.0 * head->pct + 0.5),
- (int) head->max / 60);
+ (int) head->max / 60,
+ head->flags.override_expire ? " override_expire" : null_string,
+ head->flags.override_lastmod ? " override_lastmod" : null_string);
head = head->next;
}
}
time_t min = 0;
double pct = 0.0;
time_t max = 0;
+ int override_expire = 0;
+ int override_lastmod = 0;
int i;
refresh_t *t;
regex_t comp;
pct = (double) i / 100.0;
GetInteger(i); /* token: max */
max = (time_t) (i * 60); /* convert minutes to seconds */
+ /* Options */
+ while ((token = strtok(NULL, w_space)) != NULL) {
+ if (!strcmp(token, "override-expire"))
+ override_expire = 1;
+ else if (!strcmp(token, "override-expire"))
+ override_lastmod = 1;
+ else
+ debug(22, 0) ("redreshAddToLost: Unknown option '%s': %s\n",
+ pattern, token);
+ }
if ((errcode = regcomp(&comp, pattern, flags)) != 0) {
char errbuf[256];
regerror(errcode, &comp, errbuf, sizeof errbuf);
t->max = max;
if (flags & REG_ICASE)
t->flags.icase = 1;
+ if (override_expire)
+ t->flags.override_expire = 1;
+ if (override_lastmod)
+ t->flags.override_lastmod = 1;
t->next = NULL;
while (*head)
head = &(*head)->next;
#
-# $Id: cf.data.pre,v 1.95 1998/08/14 16:42:02 wessels Exp $
+# $Id: cf.data.pre,v 1.96 1998/08/17 21:27:31 wessels Exp $
#
#
# SQUID Internet Object Cache http://squid.nlanr.net/Squid/
LOC: Config.Refresh
DEFAULT: none
DOC_START
- usage: refresh_pattern regex min percent max
+ usage: refresh_pattern regex min percent max [options]
min and max are specified in MINUTES.
percent is an integer number.
+ options: override-expire
+ override-lastmod
+
+ override-expire enforces min age even if the server
+ sent a Expires: header. Warning: This breaks HTTP
+ freshness control, and may have servere inpact on
+ the usability of sites that makes correct use of
+ Expires: headers on dynamic data.
+
+ override-lastmod enforces min age even on objects
+ that was modified recently.
+
Please see the file doc/Release-Notes-1.1.txt for a full
description of Squid's refresh algorithm. Basically a
- cached object is:
+ cached object is: (the order is changed from 1.1.X)
- FRESH if age < min
- STALE if expires < now
STALE if age > max
- FRESH if lm-factor < percent
+ FRESH if expires < now, else STALE
+ FRESH if lm-factor < percent, else STALE
+ FRESH if age < min
+ else STALE
The refresh_pattern lines are checked in the order listed here.
The first entry which matches is used. If none of the entries
/*
- * $Id: refresh.cc,v 1.30 1998/08/17 19:19:35 wessels Exp $
+ * $Id: refresh.cc,v 1.31 1998/08/17 21:27:32 wessels Exp $
*
* DEBUG: section 22 Refresh Calculation
* AUTHOR: Harvest Derived
time_t min = REFRESH_DEFAULT_MIN;
double pct = REFRESH_DEFAULT_PCT;
time_t max = REFRESH_DEFAULT_MAX;
+ int override_expire = 0;
+ int override_lastmod = 0;
const char *pattern = ".";
time_t age;
double factor;
pct = R->pct;
max = R->max;
pattern = R->pattern;
+ override_expire = R->flags.override_expire;
+ override_lastmod = R->flags.override_lastmod;
}
debug(22, 3) ("refreshCheck: Matched '%s %d %d%% %d'\n",
pattern, (int) min, (int) (100.0 * pct), (int) max);
return 1;
}
}
+ if (override_expire && age <= min) {
+ debug(22, 3) ("refreshCheck: NO: age < min && override_expire\n");
+ return 0;
+ }
if (entry->expires > -1) {
if (entry->expires <= check_time) {
debug(22, 3) ("refreshCheck: YES: expires <= curtime\n");
refreshCounts.conf_max_age_stale++;
return 1;
}
+ if (override_lastmod && age <= min) {
+ debug(22, 3) ("refreshCheck: NO: age < min && override_lastmod\n");
+ return 0;
+ }
if (entry->lastmod > -1 && entry->timestamp > entry->lastmod) {
factor = (double) age / (double) (entry->timestamp - entry->lastmod);
debug(22, 3) ("refreshCheck: factor = %f\n", factor);
/*
- * $Id: structs.h,v 1.199 1998/08/17 16:44:12 wessels Exp $
+ * $Id: structs.h,v 1.200 1998/08/17 21:27:33 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
int restore_bps;
int max_bytes;
};
+
#endif
struct _SquidConfig {
time_t max;
refresh_t *next;
struct {
- int icase:1;
+ unsigned int icase:1;
+ unsigned int override_expire:1;
+ unsigned int override_lastmod:1;
} flags;
};