Commit a583d0c6 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move the lru timestamp to objcore. Not sure how we managed to forget

that in obj.
parent 0ea83286
...@@ -428,6 +428,7 @@ struct objcore { ...@@ -428,6 +428,7 @@ struct objcore {
unsigned timer_idx; unsigned timer_idx;
VTAILQ_ENTRY(objcore) list; VTAILQ_ENTRY(objcore) list;
VTAILQ_ENTRY(objcore) lru_list; VTAILQ_ENTRY(objcore) lru_list;
double last_lru;
VTAILQ_ENTRY(objcore) ban_list; VTAILQ_ENTRY(objcore) ban_list;
struct ban *ban; struct ban *ban;
}; };
...@@ -595,7 +596,6 @@ struct object { ...@@ -595,7 +596,6 @@ struct object {
struct exp exp; struct exp exp;
double last_modified; double last_modified;
double last_lru;
struct http *http; struct http *http;
...@@ -836,7 +836,7 @@ void EXP_Set_keep(struct exp *e, double v); ...@@ -836,7 +836,7 @@ void EXP_Set_keep(struct exp *e, double v);
double EXP_Ttl(const struct req *, const struct object*); double EXP_Ttl(const struct req *, const struct object*);
double EXP_Grace(const struct req *, const struct object*); double EXP_Grace(const struct req *, const struct object*);
void EXP_Insert(struct object *o); void EXP_Insert(const struct object *o);
void EXP_Inject(struct objcore *oc, struct lru *lru, double when); void EXP_Inject(struct objcore *oc, struct lru *lru, double when);
void EXP_Init(void); void EXP_Init(void);
void EXP_Rearm(const struct object *o); void EXP_Rearm(const struct object *o);
......
...@@ -216,7 +216,7 @@ EXP_Inject(struct objcore *oc, struct lru *lru, double when) ...@@ -216,7 +216,7 @@ EXP_Inject(struct objcore *oc, struct lru *lru, double when)
*/ */
void void
EXP_Insert(struct object *o) EXP_Insert(const struct object *o)
{ {
struct objcore *oc; struct objcore *oc;
struct lru *lru; struct lru *lru;
...@@ -227,7 +227,7 @@ EXP_Insert(struct object *o) ...@@ -227,7 +227,7 @@ EXP_Insert(struct object *o)
HSH_Ref(oc); HSH_Ref(oc);
assert(o->exp.entered != 0 && !isnan(o->exp.entered)); assert(o->exp.entered != 0 && !isnan(o->exp.entered));
o->last_lru = o->exp.entered; oc->last_lru = o->exp.entered;
lru = oc_getlru(oc); lru = oc_getlru(oc);
CHECK_OBJ_NOTNULL(lru, LRU_MAGIC); CHECK_OBJ_NOTNULL(lru, LRU_MAGIC);
......
...@@ -171,10 +171,9 @@ cnt_deliver(struct worker *wrk, struct req *req) ...@@ -171,10 +171,9 @@ cnt_deliver(struct worker *wrk, struct req *req)
req->t_resp = W_TIM_real(wrk); req->t_resp = W_TIM_real(wrk);
if (!(req->obj->objcore->flags & OC_F_PRIVATE)) { if (!(req->obj->objcore->flags & OC_F_PRIVATE)) {
if ((req->t_resp - req->obj->last_lru) > if ((req->t_resp - req->obj->objcore->last_lru) >
cache_param->lru_timeout && cache_param->lru_timeout && EXP_Touch(req->obj->objcore))
EXP_Touch(req->obj->objcore)) req->obj->objcore->last_lru = req->t_resp;
req->obj->last_lru = req->t_resp;
if (!cache_param->obj_readonly) if (!cache_param->obj_readonly)
req->obj->last_use = req->t_resp; /* XXX: locking ? */ req->obj->last_use = req->t_resp; /* XXX: locking ? */
} }
......
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