Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F16866085
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
ema
Apr 9 2018, 2:55 PM
2018-04-09 14:55:38 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
varnishtest "return deliver in vcl_hit (using keep)"
server s1 {
rxreq
txresp -hdr "Cache-Control: s-maxage=2" -hdr "Last-Modified: Tue, 03 Apr 2018 21:35:51 +0200" -hdr "X-Resp-ID: 1"
rxreq
txresp -hdr "Cache-Control: s-maxage=2" -hdr "Last-Modified: Tue, 03 Apr 2018 21:35:51 +0200" -hdr "X-Resp-ID: 2"
} -start
varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.grace = 0s;
set beresp.keep = 5s;
}
sub vcl_hit {
return(deliver);
}
} -start
# First request, cache miss
client c1 {
txreq
rxresp
expect resp.http.X-Resp-ID == 1
} -run
varnish v1 -expect cache_hit == 0
varnish v1 -expect cache_miss == 1
# Second request, cache hit
client c2 {
txreq
rxresp
expect resp.http.X-Resp-ID == 1
} -run
varnish v1 -expect cache_hit == 1
varnish v1 -expect cache_miss == 1
# Third request waiting 3s to make the 2s ttl expire. This will result in a
# bgfetch and the stale object being returned. Still considered a cache hit.
client c3 {
delay 3
txreq
rxresp
expect resp.http.X-Resp-ID == 1
} -run
varnish v1 -expect cache_hit == 2
varnish v1 -expect cache_miss == 1
# Fourth request.
client c4 {
txreq
rxresp
expect resp.http.X-Resp-ID == 2
} -run
varnish v1 -expect cache_hit == 3
varnish v1 -expect cache_miss == 1
varnish v1 -expect n_expired == 0
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5720034
Default Alt Text
(1 KB)
Attached To
Mode
P6970 vcl_hit-deliver-keep.vtc
Attached
Detach File
Event Timeline
Log In to Comment