From 1d8445c6b3bdc7e49781271827659a354c3530b8 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 14 Jan 2008 09:19:06 +0000 Subject: [PATCH] Add support for obj.prefetch variable git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2342 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 1 + varnish-cache/bin/varnishd/cache_vrt.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 95815fc3..a38821bb 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -248,6 +248,7 @@ struct object { double age; double entered; double ttl; + double prefetch; double last_modified; diff --git a/varnish-cache/bin/varnishd/cache_vrt.c b/varnish-cache/bin/varnishd/cache_vrt.c index 798fa215..12cc68fb 100644 --- a/varnish-cache/bin/varnishd/cache_vrt.c +++ b/varnish-cache/bin/varnishd/cache_vrt.c @@ -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) \ -- 2.39.5