]> err.no Git - varnish/commitdiff
Implement TTL adjustment from VCL
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 21 Jul 2006 21:28:51 +0000 (21:28 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 21 Jul 2006 21:28:51 +0000 (21:28 +0000)
Log in shmem where the TTL came from (doc-candidate):

696613561 RFC 900 1153517009 1153517014 1153517914 900 0
        |         |   |   |          |          |          |   |
        |         |   |   |          |          |          |   age
        |         |   |   |          |          |          max-age
        |         |   |   |          |          Expires: header
        |         |   |   |          Date: header
        |         |   |   "now"
        |         |   TTL relative to "now"
        |         who set the TTL
        xid of object

or

696613561 VCL 20 1153517009
|         |   |  |
|         |   |  "now"
|         |   TTL relative to "now"
|         who set the TTL
        xid of object

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

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

index 6ed7b92e190c064fc6cfc8bbcedd5d6bdb26882b..b42f4f14694f10b87b0bd6882a94cf1c8d216810 100644 (file)
@@ -113,7 +113,11 @@ VRT_l_obj_ttl(struct sess *sp, double a)
 {
 
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-       (void)a;
+       CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);       /* XXX */
+       VSL(SLT_TTL, sp->fd, "%u VCL %.0f %u", sp->obj->xid, a, sp->t_req);
+       sp->obj->ttl = sp->t_req + a;
+       if (sp->obj->heap_idx != 0)
+               EXP_TTLchange(sp->obj);
 }
 
 double
index f20ca5ee2531986a408cfb5552c822eca21650a0..ee6e1631bd5312a075994b4aa1e5577f76ea2477 100644 (file)
@@ -71,7 +71,7 @@
 #endif
 
 static time_t
-RFC2616_Ttl(int fd, struct http *hp, time_t t_req, time_t t_resp, struct object *obj)
+RFC2616_Ttl(struct sess *sp, struct http *hp, time_t t_req, time_t t_resp, struct object *obj)
 {
        int retirement_age;
        unsigned u1, u2;
@@ -119,7 +119,7 @@ RFC2616_Ttl(int fd, struct http *hp, time_t t_req, time_t t_resp, struct object
        }
 
        /* calculated TTL, Our time, Date, Expires, max-age, age */
-       VSL(SLT_TTL, fd, "%d %d %d %d %d %d",
+       VSL(SLT_TTL, sp->fd, "%u RFC %d %d %d %d %d %d", sp->xid,
            (int)(ttd - t_req), (int)t_req, (int)h_date, (int)h_expires,
            (int)u1, (int)u2);
 
@@ -155,7 +155,7 @@ RFC2616_cache_policy(struct sess *sp, struct http *hp)
                break;
        }
 
-       sp->obj->ttl = RFC2616_Ttl(sp->fd, hp, sp->t_req, sp->t_resp, sp->obj);
+       sp->obj->ttl = RFC2616_Ttl(sp, hp, sp->t_req, sp->t_resp, sp->obj);
        sp->obj->entered = sp->t_req;
        if (sp->obj->ttl == 0) {
                sp->obj->cacheable = 0;