博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
varnish 4.0 官方文档翻译15- VCL objects/actions
阅读量:6911 次
发布时间:2019-06-27

本文共 2386 字,大约阅读时间需要 7 分钟。

hot3.png

Request and response VCL objects

VCL中有些需要你注意的重要对象。这些对象可以在VCL被使用和操作。

reqThe request object. When Varnish has received the request the req object is created and populated. Most of the work you do in vcl_recv you do on or with the req    object.请求对象。当vanish接收到请求后,req对象被创建和生成。你可以在vcl_recv中使用req对象做很多事。bereqThe backend request object. Varnish contructs this before sending it to the backend. It is based on the req object.后端请求对象。varnish在发送请求到后端之前构建这个对象。它基于req对象。berespThe backend response object. It contains the headers of the object coming from the backend. If you want to modify the response coming from the server you modify    this object in vcl_backend_response.后端响应对象。它包含在从后端响应对象的头里。如果你想修改后端server返回的响应信息,你可以在vcl_backend_response中修改beresp对象。respThe HTTP response right before it is delivered to the client. It is typically modified in vcl_deliver.传递给客户端响应之前的response对象。通常在vcl_deliver中修改。objThe object as it is stored in cache. Read only.存储在缓存中的对象。 只读。

actions

最常见的动作return这些:

passWhen you return pass the request and subsequent response will be passed to and from the backend server. It won't be cached. pass can be returned from vcl_recv.当你在子程序中return(pass)请求和随后的响应将被传递到后端server和从后端server回传回来。响应将不会被缓存。pass可以从vcl_recv中返回。hashWhen you return hash from vcl_recv you tell Varnish to deliver content from cache even if the request othervise indicates that the request should be passed.在*vcl_recv*中return(hash),通知varnish从cache查找请求内容,除非这个请求不被标示,那么请求应当被pass。pipe .. XXX:What is pipe? bencPipe can be returned from vcl_recv as well. Pipe short circuits the client and the backend connections and Varnish will just sit there and shuffle bytes back and   forth. Varnish will not look at the data being send back and forth - so your logs will be incomplete.pipe也可以在*vcl_recv*中返回,return(pipe)。deliverDeliver the object to the client. Usually returned from vcl_backend_response.传递对象给客户端。通常在vcl_backend_response中return。restartRestart processing of the request. You can restart the processing of the whole transaction. Changes to the req object are retained.重新对请求进行处理。你可以在整个请求处理的阶段重启。更改过的req对象将被保留。retryRetry the request against the backend. This can be returned from vcl_backend_response or vcl_backend_error if you don't like the response that the backend delivered    .重启指向后端的请求。如果你不想从后端获得响应,你可以在vcl_backend_response 或者vcl_backend_error 中return。

转载于:https://my.oschina.net/monkeyzhu/blog/467267

你可能感兴趣的文章
iptable
查看>>
[python的奇葩事]文件名不能与模块名同名
查看>>
删除win7多余引导项
查看>>
[李景山php]每天TP5-20170104|thinkphp5-File.php-1
查看>>
ehcache作为分布式缓存的研究
查看>>
Mysql for windows (MySQL开发)
查看>>
php测试kafka
查看>>
js获取两个日期之间时间差(天数)
查看>>
Memcached 简介
查看>>
开始考虑程序兼容ESP8266和PYBOARD的问题
查看>>
自定义Windows 7右键发送到选项
查看>>
我的友情链接
查看>>
虚拟化二、Xen虚拟化技术
查看>>
Spring Boot学习--属性配置和使用
查看>>
CentOS 安装 apache
查看>>
Oracle 11g数据库随系统自动启动与关闭的设置方法
查看>>
redhat 桥接配置
查看>>
比肩微信小程序的快应用联盟
查看>>
天猫与九大快递合作 价格热战之后的冷静竞争
查看>>
git pull force
查看>>