The amount of time after obj.ttl this object can be served, provided
we are already trying to fetch a new copy.
Nothing inspects this variable yet.
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2391
d4fa192b-c00b-0410-8231-
f00ffab90ce4
double age;
double entered;
double ttl;
+ double grace;
double prefetch;
double last_modified;
return (sp->obj->ttl - sp->t_req);
}
+/*--------------------------------------------------------------------
+ * obj.grace is relative to obj.ttl, so no special magic is necessary.
+ */
+
+void
+VRT_l_obj_grace(const struct sess *sp, double a)
+{
+
+ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+ CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); /* XXX */
+ if (a < 0)
+ a = 0;
+ sp->obj->grace = a;
+}
+
+double
+VRT_r_obj_grace(const struct sess *sp)
+{
+ CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+ CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); /* XXX */
+ return (sp->obj->grace);
+}
+
/*--------------------------------------------------------------------*/
/* XXX: the VCL_info messages has unexpected fractions on the ttl */
void VRT_l_obj_cacheable(const struct sess *, unsigned);
double VRT_r_obj_ttl(const struct sess *);
void VRT_l_obj_ttl(const struct sess *, double);
+double VRT_r_obj_grace(const struct sess *);
+void VRT_l_obj_grace(const struct sess *, double);
double VRT_r_obj_prefetch(const struct sess *);
void VRT_l_obj_prefetch(const struct sess *, double);
double VRT_r_obj_lastuse(const struct sess *);
vsb_cat(sb, "void VRT_l_obj_cacheable(const struct sess *, unsigned);\n");
vsb_cat(sb, "double VRT_r_obj_ttl(const struct sess *);\n");
vsb_cat(sb, "void VRT_l_obj_ttl(const struct sess *, double);\n");
+ vsb_cat(sb, "double VRT_r_obj_grace(const struct sess *);\n");
+ vsb_cat(sb, "void VRT_l_obj_grace(const struct sess *, double);\n");
vsb_cat(sb, "double VRT_r_obj_prefetch(const struct sess *);\n");
vsb_cat(sb, "void VRT_l_obj_prefetch(const struct sess *, double);\n");
vsb_cat(sb, "double VRT_r_obj_lastuse(const struct sess *);\n");
{ hit fetch discard timeout}
"const struct sess *"
}
+ { obj.grace
+ RW TIME
+ { hit fetch discard timeout}
+ "const struct sess *"
+ }
{ obj.prefetch
RW RTIME
{ fetch prefetch }
0,
VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DISCARD | VCL_MET_TIMEOUT
},
+ { "obj.grace", TIME, 9,
+ "VRT_r_obj_grace(sp)",
+ "VRT_l_obj_grace(sp, ",
+ V_RW,
+ 0,
+ VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DISCARD | VCL_MET_TIMEOUT
+ },
{ "obj.prefetch", RTIME, 12,
"VRT_r_obj_prefetch(sp)",
"VRT_l_obj_prefetch(sp, ",