Hello All,
To use the refresh_pattern in fractions,I have attatched a patch as refresh_fraction.patch
The calculation changes are needed in the cache_cf.c for the float.
I have tested for the refresh time as
refresh_pattern . 0 20% 4320.12
as well as
refresh_pattern . 0 20% 1.12
Debug information on the cache.log is as
2004/02/18 19:26:57| Refresh Values: min=0 max=259207 (max=4320.12)
2004/02/18 19:21:28| Refresh Values: min=0 max=67 (max=1.12)
To test the calculation use this,
#include <sys/types.h>
main()
{
float i=4320.12,min=60.11,max=0.0; /* 4320.12 for the fration time */
max = (int)(time_t)(i*60);
printf("Max Refresh Time:%f\n",max);
printf("Max Refresh Time:%d\n",(int)max);
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
refresh_patter.patch
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
--- cache_cf_old.c 2004-02-18 19:34:53.000000000 +0530
+++ cache_cf.c 2004-02-18 19:38:12.000000000 +0530
@@ -218,6 +218,23 @@
return i;
}
+/*
+* Used to get the fractional or normal refresh pattern values
+*/
+
+float
+Getfloat(void)
+{
+ char *token = strtok(NULL, w_space);
+ float i;
+ if (token == NULL)
+ self_destruct();
+ if (sscanf(token, "%f", &i) != 1)
+ self_destruct();
+ return i;
+}
+
+
static void
update_maxobjsize(void)
{
@@ -1816,6 +1833,7 @@
int ignore_reload = 0;
#endif
int i;
+ float j;
refresh_t *t;
regex_t comp;
int errcode;
@@ -1832,12 +1850,12 @@
if (token == NULL)
self_destruct();
pattern = xstrdup(token);
- i = GetInteger(); /* token: min */
- min = (time_t) (i * 60); /* convert minutes to seconds */
+ j = Getfloat(); /* token: min */
+ min = (int)(time_t) (j * 60); /* convert minutes to seconds */
i = GetInteger(); /* token: pct */
pct = (double) i / 100.0;
- i = GetInteger(); /* token: max */
- max = (time_t) (i * 60); /* convert minutes to seconds */
+ j = Getfloat(); /* token: max */
+ max = (int)(time_t) (j * 60); /* convert minutes to seconds */
/* Options */
while ((token = strtok(NULL, w_space)) != NULL) {
#if HTTP_VIOLATIONS
@@ -1875,6 +1893,7 @@
t->min = min;
t->pct = pct;
t->max = max;
+ debug(22, 1) ("Refresh Values: min=%d max=%d\n",(int)min,(int)max);
if (flags & REG_ICASE)
t->flags.icase = 1;
#if HTTP_VIOLATIONS
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Review is needed.
Regards,
Muthukumar.
Received on Wed Feb 18 2004 - 07:55:49 MST
This archive was generated by hypermail pre-2.1.9 : Mon Mar 01 2004 - 12:00:02 MST