]> err.no Git - varnish/commitdiff
Add support for obj.prefetch variable
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 14 Jan 2008 09:19:06 +0000 (09:19 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 14 Jan 2008 09:19:06 +0000 (09:19 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2342 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_vrt.c

index 95815fc3de56c16eccf9904ec5c699f7381bb283..a38821bbae6eb99864075246dea49f454c85da35 100644 (file)
@@ -248,6 +248,7 @@ struct object {
        double                  age;
        double                  entered;
        double                  ttl;
+       double                  prefetch;
 
        double                  last_modified;
 
index 798fa215fdd8ee0647baa69ce0a88b9715f812a2..12cc68fb88af1e44642d23d00c33a119c68512c4 100644 (file)
@@ -306,6 +306,27 @@ VRT_r_obj_ttl(const struct sess *sp)
 
 /*--------------------------------------------------------------------*/
 
+void
+VRT_l_obj_prefetch(const struct sess *sp, double a)
+{
+
+       CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+       CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);       /* XXX */
+       sp->obj->prefetch = a;
+       if (a > 0.0)
+               sp->obj->prefetch += sp->t_req;
+}
+
+double
+VRT_r_obj_prefetch(const struct sess *sp)
+{
+       CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+       CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);       /* XXX */
+       return (sp->obj->prefetch - sp->t_req);
+}
+
+/*--------------------------------------------------------------------*/
+
 #define VOBJ(type,onm,field)                                           \
 void                                                                   \
 VRT_l_obj_##onm(const struct sess *sp, type a)                         \