- From: James Gallagher <jimg@dcz.dods.org>
- Date: Tue, 28 Mar 2000 09:38:11 -0800 (PST)
- To: www-lib@w3c.org
- Message-ID: <14560.60931.921425.842351@dcz.dods.org>
Hello, I've been working with the HTTP Cache and I needed to be able to set the default expiration time from my client. Of course, default expiration times for cached items are not a good thing in general, but it seems that if you're going to have one at all it might as well be something the client can set. Here's a patch for HTCache.html,c that adds two functions which can be used to set the DefaultExpiration private member. HTCacheMode_setDefaultExpiration(const int) sets the default expiration and HTCacheMode_defaultExpiration() returns it. James
--- src-old/HTCache.c Tue Mar 14 20:58:49 2000
+++ src/HTCache.c Mon Mar 27 15:54:23 2000
@@ -883,6 +883,19 @@
}
/*
+** Set the default expiration time. In seconds.
+*/
+PUBLIC void HTCacheMode_setDefaultExpiration (const int exp_time)
+{
+ DefaultExpiration = exp_time;
+}
+
+PUBLIC int HTCacheMode_DefaultExpiration (void)
+{
+ return DefaultExpiration;
+}
+
+/*
** Cache size management. We set the default cache size to 20M.
** We set the minimum size to 5M in order not to get into weird
** problems while writing the cache. The size is indicated in Mega
--- src-old/HTCache.html Tue Mar 28 09:31:20 2000
+++ src/HTCache.html Mon Mar 27 15:54:23 2000
@@ -140,6 +140,13 @@
extern void HTCacheMode_setExpires (HTExpiresMode mode);
extern HTExpiresMode HTCacheMode_expires (void);
</PRE>
+If a response does not arrive with an expiration time and does not
+explicitly forbid its being cached, use the default expiration time. The
+time is given in seconds (e.g., 3,600 is one hour).
+<PRE>
+extern void HTCacheMode_setDefaultExpiration (const int exp_time);
+extern int HTCacheMode_DefaultExpiration (void);
+</PRE>
<H3>
Disconnected Operation
</H3>
Received on Tuesday, 28 March 2000 12:38:33 UTC