squid 缓存原理_squid缓存管理员_redis缓存原理与实现

电脑杂谈  发布时间:2017-02-18 11:39:26  来源:网络整理

squid缓存管理员_squid 缓存原理_redis缓存原理与实现

一、查看squid命中情况

除了之前在squid的access.log中查看squid缓存命中的方法之外,还可以通过以下方法进行查看:

这里对图片服务器的httpd配置文件添加一些新的配置如下:

ExpiresActive on

ExpiresDefault "access plus 12 month"

ExpiresByType text/html "access plus 12 months"

ExpiresByType text/css "access plus 12 months"

ExpiresByType image/gif "access plus 12 months"

ExpiresByType image/jpeg "access plus 12 months"

ExpiresByType image/jpg "access plus 12 months"

ExpiresByType image/png "access plus 12 months"

ExpiresByType application/x-javascript "access plus 12 months"

ExpiresByType vedio/x-flv "access plus 12 months"

把以上内容追加到httpd.conf文件中,然后重新启动httpd服务。

1)使用curl命令查看

[root@squid ~]# curl -I -s

HTTP/1.0 200 OK

Date: Mon, 31 Oct 2016 03:10:20 GMT

Server: Apache/2.2.15 (CentOS)

Last-Modified: Thu, 26 Jun 2014 01:12:31 GMT

ETag: "bf742-2f37a-4fcb2e3149dc0"

Accept-Ranges: bytes

Content-Length: 193402

Content-Type: image/jpeg

Age: 22522

X-Cache: HIT from cache1.contoso.com

Via: 1.0 cache1.contoso.com (squid/3.0.STABLE20)

Connection: close

[root@squid ~]# curl -I -s |grep -i x-cache

X-Cache: HIT from cache1.contoso.com

[root@squid ~]# curl -I -s |grep -i x-cache

X-Cache: HIT from cache1.contoso.com

[root@squid ~]# curl -I -s |grep -i x-cache

X-Cache: HIT from cache1.contoso.com

[root@squid ~]# curl -I -s |grep -i x-cache

X-Cache: HIT from cache1.contoso.com

2)使用Firefox的firebug插件进行查看

可以看到,在响应头信息中,有max-age也就是我在httpd中设置的expire时间,同样也可以在Expires看到过期时间,Server项显示web服务器的类型,这里是Apache;Via表示通过哪个代理服务器进行访问,这里是我在squid.conf中配置的名称cache1.contoso.com(后面还有squid的版本信息);X-Cache中HIT from cache1.contoso.com表示请求内容在cache1.contoso.com上命中。


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-33117-1.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...