Revision: 14411
Author: adrian.chadd
Date: Tue Feb 16 03:21:51 2010
Log: Port r12475 from squid-2: Bug #2631: store-stale refresh_pattern option
Author: Mark Nottingham <[email protected]>
Reference:
http://www.squid-cache.org/Versions/v2/HEAD/changesets/12475.patch
http://code.google.com/p/lusca-cache/source/detail?r=14411
Modified:
/branches/LUSCA_HEAD/src/cache_cf.c
/branches/LUSCA_HEAD/src/cf.data.pre
/branches/LUSCA_HEAD/src/http.c
/branches/LUSCA_HEAD/src/structs.h
=======================================
--- /branches/LUSCA_HEAD/src/cache_cf.c Thu Oct 15 16:08:35 2009
+++ /branches/LUSCA_HEAD/src/cache_cf.c Tue Feb 16 03:21:51 2010
@@ -2270,6 +2270,8 @@
storeAppendPrintf(entry, " max-stale=%d", head->max_stale);
if (head->negative_ttl >= 0)
storeAppendPrintf(entry, " negative-ttl=%d", head->negative_ttl);
+ if (head->flags.store_stale)
+ storeAppendPrintf(entry, " store-stale");
storeAppendPrintf(entry, "\n");
head = head->next;
}
@@ -2295,6 +2297,7 @@
#endif
int stale_while_revalidate = -1;
int ignore_stale_while_revalidate = 0;
+ int store_stale = 0;
int max_stale = -1;
int negative_ttl = -1;
int i;
@@ -2353,6 +2356,8 @@
negative_ttl = atoi(token + 13);
} else if (!strcmp(token, "ignore-stale-while-revalidate")) {
ignore_stale_while_revalidate = 1;
+ } else if (!strcmp(token, "store-stale")) {
+ store_stale = 1;
} else {
debug(22, 0) ("parse_refreshpattern: Unknown option '%s': %s\n",
pattern, token);
@@ -2395,6 +2400,8 @@
if (ignore_auth)
t->flags.ignore_auth = 1;
#endif
+ if (store_stale)
+ t->flags.store_stale = 1;
t->flags.ignore_stale_while_revalidate = ignore_stale_while_revalidate;
t->stale_while_revalidate = stale_while_revalidate;
t->max_stale = max_stale;
=======================================
--- /branches/LUSCA_HEAD/src/cf.data.pre Wed Jan 6 06:14:54 2010
+++ /branches/LUSCA_HEAD/src/cf.data.pre Tue Feb 16 03:21:51 2010
@@ -3121,6 +3121,7 @@
ignore-stale-while-revalidate
max-stale=NN
negative-ttl=NN
+ store-stale
override-expire enforces min age even if the server
sent an explicit expiry time (e.g., with the
@@ -3175,6 +3176,12 @@
negative-ttl=NN overrides the global negative_ttl parameter
selectively for URLs matching this pattern (in seconds).
+
+ store-stale stores responses even if they don't have explicit
+ freshness or a validator (i.e., Last-Modified or an ETag)
+ present, or if they're already stale. By default, Squid will
+ not cache such responses because they usually can't be
+ reused. Note that such responses will be stale by default.
Basically a cached object is:
=======================================
--- /branches/LUSCA_HEAD/src/http.c Mon Oct 26 23:58:33 2009
+++ /branches/LUSCA_HEAD/src/http.c Tue Feb 16 03:21:51 2010
@@ -331,7 +331,7 @@
* Don't cache objects that need to be refreshed on next request,
* unless we know how to refresh it.
*/
- if (!refreshIsCachable(httpState->entry))
+ if (!refreshIsCachable(httpState->entry)
&& !REFRESH_OVERRIDE(store_stale))
return 0;
/* don't cache objects from peers w/o LMT, Date, or Expires */
/* check that is it enough to check headers @?@ */
=======================================
--- /branches/LUSCA_HEAD/src/structs.h Wed Oct 28 23:27:28 2009
+++ /branches/LUSCA_HEAD/src/structs.h Tue Feb 16 03:21:51 2010
@@ -1745,6 +1745,7 @@
unsigned int ignore_auth:1;
#endif
unsigned int ignore_stale_while_revalidate:1;
+ unsigned int store_stale:1;
} flags;
int max_stale;
int stale_while_revalidate;
--
You received this message because you are subscribed to the Google Groups
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/lusca-commit?hl=en.