Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
e0acf69d
Commit
e0acf69d
authored
Oct 04, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assign obj.keep and obj.grace from defaults on obj creation.
Losse EXP_Grace() and EXP_Keep() functions
parent
6cb94654
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
15 additions
and
35 deletions
+15
-35
cache.h
bin/varnishd/cache/cache.h
+0
-1
cache_expire.c
bin/varnishd/cache/cache_expire.c
+2
-27
cache_rfc2616.c
bin/varnishd/cache/cache_rfc2616.c
+2
-1
storage_persistent.c
bin/varnishd/storage/storage_persistent.c
+1
-1
storage_persistent_silo.c
bin/varnishd/storage/storage_persistent_silo.c
+2
-5
p00001.vtc
bin/varnishtest/tests/p00001.vtc
+3
-0
s00000.vtc
bin/varnishtest/tests/s00000.vtc
+2
-0
s00001.vtc
bin/varnishtest/tests/s00001.vtc
+3
-0
No files found.
bin/varnishd/cache/cache.h
View file @
e0acf69d
...
...
@@ -904,7 +904,6 @@ void EXP_Set_grace(struct exp *e, double v);
void
EXP_Set_keep
(
struct
exp
*
e
,
double
v
);
double
EXP_Ttl
(
const
struct
req
*
,
const
struct
object
*
);
double
EXP_Grace
(
const
struct
req
*
,
const
struct
object
*
);
void
EXP_Insert
(
const
struct
object
*
o
,
double
now
);
void
EXP_Inject
(
struct
objcore
*
oc
,
struct
lru
*
lru
,
double
when
);
void
EXP_Init
(
void
);
...
...
bin/varnishd/cache/cache_expire.c
View file @
e0acf69d
...
...
@@ -107,28 +107,6 @@ EXP_ACCESS(keep, 0.,)
* adjusted for defaults and by per-session limits.
*/
static
double
EXP_Keep
(
const
struct
req
*
req
,
const
struct
object
*
o
)
{
double
r
;
r
=
(
double
)
cache_param
->
default_keep
;
if
(
o
->
exp
.
keep
>
0
.)
r
=
o
->
exp
.
keep
;
return
(
EXP_Ttl
(
req
,
o
)
+
r
);
}
double
EXP_Grace
(
const
struct
req
*
req
,
const
struct
object
*
o
)
{
double
r
;
r
=
(
double
)
cache_param
->
default_grace
;
if
(
o
->
exp
.
grace
>=
0
.)
r
=
o
->
exp
.
grace
;
return
(
EXP_Ttl
(
req
,
o
)
+
r
);
}
double
EXP_Ttl
(
const
struct
req
*
req
,
const
struct
object
*
o
)
{
...
...
@@ -148,17 +126,14 @@ static int
update_object_when
(
const
struct
object
*
o
)
{
struct
objcore
*
oc
;
double
when
,
w2
;
double
when
;
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
oc
=
o
->
objcore
;
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
Lck_AssertHeld
(
&
exp_mtx
);
when
=
EXP_Keep
(
NULL
,
o
);
w2
=
EXP_Grace
(
NULL
,
o
);
if
(
w2
>
when
)
when
=
w2
;
when
=
o
->
exp
.
t_origin
+
o
->
exp
.
ttl
+
o
->
exp
.
grace
+
o
->
exp
.
keep
;
assert
(
!
isnan
(
when
));
if
(
when
==
oc
->
timer_when
)
return
(
0
);
...
...
bin/varnishd/cache/cache_rfc2616.c
View file @
e0acf69d
...
...
@@ -79,8 +79,9 @@ RFC2616_Ttl(struct busyobj *bo)
assert
(
bo
->
t_fetch
!=
0
.
0
&&
!
isnan
(
bo
->
t_fetch
));
expp
->
t_origin
=
bo
->
t_fetch
;
/* If all else fails, cache using default ttl */
expp
->
ttl
=
cache_param
->
default_ttl
;
expp
->
grace
=
cache_param
->
default_grace
;
expp
->
keep
=
cache_param
->
default_keep
;
max_age
=
age
=
0
;
h_expires
=
0
;
...
...
bin/varnishd/storage/storage_persistent.c
View file @
e0acf69d
...
...
@@ -547,7 +547,7 @@ smp_allocobj(struct stevedore *stv, struct busyobj *bo,
/* We have to do this somewhere, might as well be here... */
assert
(
sizeof
so
->
hash
==
DIGEST_LEN
);
memcpy
(
so
->
hash
,
oc
->
objhead
->
digest
,
DIGEST_LEN
);
so
->
ttl
=
EXP_Grace
(
NULL
,
o
)
;
so
->
ttl
=
oc
->
timer_when
;
so
->
ptr
=
(
uint8_t
*
)
o
-
sc
->
base
;
so
->
ban
=
BAN_Time
(
oc
->
ban
);
...
...
bin/varnishd/storage/storage_persistent_silo.c
View file @
e0acf69d
...
...
@@ -480,7 +480,6 @@ smp_oc_updatemeta(struct objcore *oc)
struct
object
*
o
;
struct
smp_seg
*
sg
;
struct
smp_object
*
so
;
double
mttl
;
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
o
=
smp_oc_getobj
(
NULL
,
oc
);
...
...
@@ -490,17 +489,15 @@ smp_oc_updatemeta(struct objcore *oc)
CHECK_OBJ_NOTNULL
(
sg
->
sc
,
SMP_SC_MAGIC
);
so
=
smp_find_so
(
sg
,
oc
->
priv2
);
mttl
=
EXP_Grace
(
NULL
,
o
);
if
(
sg
==
sg
->
sc
->
cur_seg
)
{
/* Lock necessary, we might race close_seg */
Lck_Lock
(
&
sg
->
sc
->
mtx
);
so
->
ban
=
BAN_Time
(
oc
->
ban
);
so
->
ttl
=
mttl
;
so
->
ttl
=
oc
->
timer_when
;
Lck_Unlock
(
&
sg
->
sc
->
mtx
);
}
else
{
so
->
ban
=
BAN_Time
(
oc
->
ban
);
so
->
ttl
=
mttl
;
so
->
ttl
=
oc
->
timer_when
;
}
}
...
...
bin/varnishtest/tests/p00001.vtc
View file @
e0acf69d
...
...
@@ -13,6 +13,9 @@ varnish v1 \
-storage "-spersistent,${tmpdir}/_.per,10m" \
-vcl+backend { } -start
varnish v1 -cliok "param.set default_grace 0"
varnish v1 -cliok "param.set default_keep 0"
client c1 {
txreq -url "/"
rxresp
...
...
bin/varnishtest/tests/s00000.vtc
View file @
e0acf69d
...
...
@@ -11,6 +11,8 @@ server s1 {
} -start
varnish v1 -vcl+backend { } -start
varnish v1 -cliok "param.set default_grace 0"
varnish v1 -cliok "param.set default_keep 0"
client c1 {
txreq -url "/"
...
...
bin/varnishtest/tests/s00001.vtc
View file @
e0acf69d
...
...
@@ -12,6 +12,9 @@ server s1 {
varnish v1 -vcl+backend { } -start
varnish v1 -cliok "param.set default_keep 0"
varnish v1 -cliok "param.set default_grace 0"
client c1 {
txreq -url "/"
rxresp
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment