]> err.no Git - varnish/commitdiff
Fix obj.last_use: We cannot use obj.lru_stamp, as that is only updated
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 23 Feb 2008 19:58:04 +0000 (19:58 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 23 Feb 2008 19:58:04 +0000 (19:58 +0000)
when we shuffle the LRU list.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2535 d4fa192b-c00b-0410-8231-f00ffab90ce4

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

index 4c535fb2e228488b7eef7cb5773de9cd9e806e63..c18a6b185c6902730f7988c9ef4c2360042af56c 100644 (file)
@@ -275,6 +275,7 @@ struct object {
        VTAILQ_HEAD(, esi_bit)  esibits;
 
        double                  lru_stamp;
+       double                  last_use;
 
        /* Prefetch */
        struct object           *parent;
index 988f5cd5c0beaf79d123715f5621420a285c856a..fab7232c35931bd8572890da19c61d6e376aa3f3 100644 (file)
@@ -151,8 +151,10 @@ cnt_deliver(struct sess *sp)
        CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
 
        sp->t_resp = TIM_real();
-       if (sp->obj->objhead != NULL)
+       if (sp->obj->objhead != NULL) {
+               sp->obj->last_use = sp->t_resp; /* XXX: locking ? */
                EXP_Touch(sp->obj, sp->t_resp);
+       }
        RES_BuildHttp(sp);
        VCL_deliver_method(sp);
        switch (sp->handling) {
index 9534a80b616f2a3b6f9ff0686a42b9578036ab0e..64c1a1a0ce79a25ab0ea41d66bf293e9e53121bd 100644 (file)
@@ -535,7 +535,7 @@ VRT_r_obj_lastuse(const struct sess *sp)
 
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
        CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);       /* XXX */
-       return (TIM_real() - sp->obj->lru_stamp);
+       return (TIM_real() - sp->obj->last_use);
 }
 
 int