From: des Date: Tue, 4 Mar 2008 10:59:32 +0000 (+0000) Subject: Implement obj.hash. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b6abe6b71966941f710542cb6dce6d269435fbf;p=varnish Implement obj.hash. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2551 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_vrt.c b/varnish-cache/bin/varnishd/cache_vrt.c index 842bcfde..fcc6b6db 100644 --- a/varnish-cache/bin/varnishd/cache_vrt.c +++ b/varnish-cache/bin/varnishd/cache_vrt.c @@ -539,6 +539,16 @@ VRT_r_obj_lastuse(const struct sess *sp) return (TIM_real() - sp->obj->last_use); } +const char * +VRT_r_obj_hash(struct sess *sp) +{ + + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); + CHECK_OBJ_NOTNULL(sp->obj->objhead, OBJHEAD_MAGIC); + return (sp->obj->objhead->hash); +} + int VRT_r_backend_health(const struct sess *sp) { diff --git a/varnish-cache/include/vrt_obj.h b/varnish-cache/include/vrt_obj.h index ba294512..ccce68bf 100644 --- a/varnish-cache/include/vrt_obj.h +++ b/varnish-cache/include/vrt_obj.h @@ -43,6 +43,7 @@ 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 *); +const char *VRT_r_obj_hash(struct sess *sp); const char * VRT_r_resp_proto(const struct sess *); void VRT_l_resp_proto(const struct sess *, const char *, ...); int VRT_r_resp_status(const struct sess *); diff --git a/varnish-cache/lib/libvcl/vcc_obj.c b/varnish-cache/lib/libvcl/vcc_obj.c index 6c4fe081..5a008ee6 100644 --- a/varnish-cache/lib/libvcl/vcc_obj.c +++ b/varnish-cache/lib/libvcl/vcc_obj.c @@ -179,6 +179,13 @@ struct var vcc_vars[] = { 0, VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_DISCARD | VCL_MET_TIMEOUT }, + { "obj.hash", HASH, 8, + NULL, + "VRT_l_req_hash(sp, ", + V_RO, + 0, + VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER + }, { "resp.proto", STRING, 10, "VRT_r_resp_proto(sp)", "VRT_l_resp_proto(sp, ",