Commit 25d3c5b3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Implement TTL adjustment from VCL

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: http://www.varnish-cache.org/svn/trunk/varnish-cache@551 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 7213f789
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment