[squid-users] Objects with values below 60 second for Cache-Control max-age are not cached

Garri Djavadyan garryd at comnet.uz
Mon Aug 22 11:46:47 UTC 2016


Hello Squid users,

Can anyone explain, why Squid doesn't cache the objects with max-age
values below 60 seconds? For example:

$ http_proxy="127.0.0.1:3128" curl --head "http://sandbox.comnet.local/
cgi-bin/hello.cgi" && date
HTTP/1.1 200 OK
Date: Mon, 22 Aug 2016 11:31:16 GMT
Server: Apache
Cache-Control: max-age=60
Content-Type: text/plain
X-Cache: MISS from gentoo.comnet.uz
Via: 1.1 gentoo.comnet.uz (squid/3.5.20)
Connection: keep-alive

Mon Aug 22 16:31:19 UZT 2016

---

$ http_proxy="127.0.0.1:3128" curl --head "http://sandbox.comnet.local/
cgi-bin/hello.cgi" && date
HTTP/1.1 200 OK
Date: Mon, 22 Aug 2016 11:31:23 GMT
Server: Apache
Cache-Control: max-age=60
Content-Type: text/plain
X-Cache: MISS from gentoo.comnet.uz
Via: 1.1 gentoo.comnet.uz (squid/3.5.20)
Connection: keep-alive

Mon Aug 22 16:31:26 UZT 2016


No problems with values above 60 seconds. For example:

$ http_proxy="127.0.0.1:3128" curl --head "http://sandbox.comnet.local/
cgi-bin/hello.cgi" && date
HTTP/1.1 200 OK
Date: Mon, 22 Aug 2016 11:36:06 GMT
Server: Apache
Cache-Control: max-age=70
Content-Type: text/plain
X-Cache: MISS from gentoo.comnet.uz
Via: 1.1 gentoo.comnet.uz (squid/3.5.20)
Connection: keep-alive

Mon Aug 22 16:36:09 UZT 2016

---

$ http_proxy="127.0.0.1:3128" curl --head "http://sandbox.comnet.local/
cgi-bin/hello.cgi" && date
HTTP/1.1 200 OK
Date: Mon, 22 Aug 2016 11:36:06 GMT
Server: Apache
Cache-Control: max-age=70
Content-Type: text/plain
Age: 5
X-Cache: HIT from gentoo.comnet.uz
Via: 1.1 gentoo.comnet.uz (squid/3.5.20)
Connection: keep-alive

Mon Aug 22 16:36:11 UZT 2016


As you can see, time difference between origin server and localhost is
3 seconds (UZT is +5 offset).

Configuration is minimal:

# diff -u etc/squid.conf.default etc/squid.conf
--- etc/squid.conf.default	2016-08-12 17:21:48.877474780 +0500
+++ etc/squid.conf	2016-08-22 16:41:47.759766991 +0500
@@ -71,3 +71,5 @@
 refresh_pattern ^gopher:	1440	0%	1440
 refresh_pattern -i (/cgi-bin/|\?) 0	0%	0
 refresh_pattern .		0	20%	4320
+
+cache_mem 64 MB


Thanks in advance!
Garri


More information about the squid-users mailing list