Variables

Although subroutines take no arguments, the necessary information is made available to the handler subroutines through global variables.

The following variables are always available:

now
The current time, in seconds since the epoch.
当前时间用秒表示自从纪元以来
The following variables are available in backend declarations:
下列变量用于定义后端时有效:
.host
Host name or IP address of a backend.
.port
Service name or port number of a backend.
The following variables are available while processing a request:
下列变量用于处理请求时有效:
client.ip
The client’s IP address.
server.hostname
The host name of the server.
server.identity
The identity of the server, as set by the -i parameter. If the -i parameter is not passed to varnishd, server.identity will be set to the name of the instance, as specified by the -n parameter.
server.ip
The IP address of the socket on which the client connection was received.
server.port
The port number of the socket on which the client connection was received.
req.request
The request type (e.g. “GET”, “HEAD”).
req.url
The requested URL.
req.proto
The HTTP protocol version used by the client.
req.backend
The backend to use to service the request.
req.backend.healthy
Whether the backend is healthy or not. Requires an active probe to be set on the backend.
req.http.header
The corresponding HTTP header.
req.hash_always_miss
Force a cache miss for this request. If set to true Varnish will disregard any existing objects and always (re)fetch from the backend.
req.hash_ignore_busy
Ignore any busy object during cache lookup. You would want to do this if you have two server looking up content from each other to avoid potential deadlocks.
req.can_gzip
Does the client accept the gzip transfer encoding.

The following variables are available while preparing a backend request (either for a cache miss or for pass or pipe mode):

bereq.request
The request type (e.g. “GET”, “HEAD”).
bereq.url
The requested URL.
bereq.proto
The HTTP protocol version used to talk to the server.
bereq.http.header
The corresponding HTTP header.
bereq.connect_timeout
The time in seconds to wait for a backend connection.
bereq.first_byte_timeout
The time in seconds to wait for the first byte from the backend. Not available in pipe mode.
bereq.between_bytes_timeout
The time in seconds to wait between each received byte from the backend. Not available in pipe mode.

The following variables are available after the requested object has been retrieved from the backend, before it is entered into the cache. In other words, they are available in vcl_fetch:

beresp.do_esi
Boolean. ESI-process the object after fetching it. Defaults to false. Set it to true to parse the object for ESI directives.
beresp.do_gzip
Boolean. Gzip the object before storing it. Defaults to false.
beresp.do_gunzip
Boolean. Unzip the object before storing it in the cache. Defaults to false.
beresp.proto
The HTTP protocol version used the backend replied with.
beresp.status
The HTTP status code returned by the server.
beresp.response
The HTTP status message returned by the server.
beresp.cacheable

True if the request resulted in a cacheable response. A response is considered cacheable if HTTP status code is 200, 203, 300, 301, 302, 404 or 410 and pass wasn’t called in vcl_recv. If however, both the TTL and the grace time for the response are 0 beresp.cacheable will be 0.

beresp.cacheable is writable.

beresp.ttl
The object’s remaining time to live, in seconds. beresp.ttl is writable.

After the object is entered into the cache, the following (mostly read-only) variables are available when the object has been located in cache, typically in vcl_hit and vcl_deliver.

obj.proto
The HTTP protocol version used when the object was retrieved.
obj.status
The HTTP status code returned by the server.
obj.response
The HTTP status message returned by the server.
obj.cacheable
True if the object had beresp.cacheable. Unless you’ve forced delivery in your VCL obj.cacheable will always be true.
obj.ttl
The object’s remaining time to live, in seconds. obj.ttl is writable.
obj.lastuse
The approximate time elapsed since the object was last requests, in seconds.
obj.hits
The approximate number of times the object has been delivered. A value of 0 indicates a cache miss.

The following variables are available while determining the hash key of an object:

req.hash
The hash key used to refer to an object in the cache. Used when both reading from and writing to the cache.

The following variables are available while preparing a response to the client:

resp.proto
The HTTP protocol version to use for the response.
resp.status
The HTTP status code that will be returned.
resp.response
The HTTP status message that will be returned.
resp.http.header
The corresponding HTTP header.

Values may be assigned to variables using the set keyword::

sub vcl_recv {# Normalize the Host: headerif (req.http.host ~ "(?i)^(www.)?example.com$") {set req.http.host = "www.example.com";}
}

HTTP headers can be removed entirely using the remove keyword::

sub vcl_fetch {# Don't cache cookiesremove beresp.http.Set-Cookie;
}

转载于:https://blog.51cto.com/linuxgp/602108

vanish_variables_3.0相关推荐

  1. 估算带卷积核二分类0,3的网络的收敛时间和迭代次数

    制作一个网络分类minst的0和3求出这网络的迭代次数曲线表达式n(δ),和准确率表达式p-max(δ),用预期准确率去估算n,并推算需要的时间. 将minst的28*28的图片缩小到9*9,网络用一 ...

  2. 神经网络收敛标准与准确率之间的数学关系

    制作一个带一个3*3卷积核的神经网络,测试集是minst的0和2图片集,将28*28的图片缩小成9*9,隐藏层30个节点所以网络的结构是 S(minst0)-(con3*3)49-30-2-(1,0) ...

  3. 用共振频率去进行图片分类的尝试

    假设有一种物质,这种物质的原子核的质子数和电子数可以不同,允许质子的带电量不同,并且质子带负电,同时这个原子的电子不满足鲍利不相容原理,环境温度是 (1/1.3806505)*10^23k,电子波的频 ...

  4. 收敛标准对迭代次数影响

    制作一个n*n的网络,将收敛标准分别设定在,0.001,0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,观察网络达到平衡时迭代次数的变化. 比如如图的 ...

  5. vue省市区三级联动mysql,js/json,html/jsp

    大家好,我是烤鸭: 省市区三级联动数据及页面: 测试的时候,发现少了几个地区,现在补上了,也优化了下排版. 如果你懒得复制和看的话,这里是打包的下载地址. 之前的资源地址也改了,http://down ...

  6. ZAM 3D 制作3D动画字幕 用于Xaml导出

    ZAM 3D 制作3D动画字幕 用于Xaml导出 原文:ZAM 3D 制作3D动画字幕 用于Xaml导出 原地址-> http://www.cnblogs.com/yk250/p/5662788 ...

  7. 将执行文件转化为bat批处理文件的工具(批处理文件方式提供)

    update 2006.4.25 15:20 支持64kb以上的执行文件/// @echo e 0100 4d 5a 90 0 3 0 0 0 4 0 0 0 ff ff 0 0 >>Da ...

  8. 完整的境外、港澳台、电信、移动、联通、教育网、国内其他ISP的IPv4列表(数据整理日期2022年4月)-IP列表太长只能份2篇发布(1/2)

    完整的境外.港澳台.电信.移动.联通.教育网.国内其他ISP的IPv4列表(数据整理日期2022年4月)-IP列表太长只能份2篇发布(1/2) 综述 境外(不含港澳台)IPv4地址 综述 企业所在地南 ...

  9. 聚宽JQData说明书

    由于内容较多,可使用Ctrl+F搜索您需要的数据. 注意:query函数的更多用法详见:sqlalchemy.orm.query.Query对象 JQData是什么 JQData是聚宽数据团队专门为金 ...

最新文章

  1. tensorflow sigmoid_cross_entropy_with_logits 函数解释
  2. 羊皮卷的故事-第十章-羊皮卷之三
  3. derhams to php,基于laravel belongsTo使用详解
  4. 光流法测试代码_高效的企业测试-工作流和代码质量(4/6)
  5. Node.jsNPM的安装与配置(转)
  6. java nslookup_nslookup使用教程
  7. java 内存管理_高性能Java代码之内存管理
  8. redis 配置文件参数详解
  9. 任天堂连遭数据泄露,《动森》太火爆惊动黑客?
  10. 没有计算机基础可以学python-要学 Python 需要怎样的基础?
  11. 最好用图像处理库CxImage入门
  12. oracle网络ora文件,Oracle错误—ORA-03113:在通信信道文件的末尾(归档日志处理)...
  13. php教程phpmeng,李炎恢PHP培训视频教程
  14. Seek the Name, Seek the Fame POJ - 2752(KMP和hah两种方法求公共前后缀)
  15. 百度分享异步加载问题、分页,无效果解决
  16. Cisco路由器重要存储设备Flash和NVRAM
  17. 成语填空微信小程序,登录接口修复版
  18. 驾培行业应对新形势“自学直考”新格局冲击剖析
  19. Java引入第三方包
  20. Matlab GUI自定义提示窗(对话框)

热门文章

  1. app拉新渠道统计如何跟踪?
  2. 谁在用琵琶弹奏一曲东风破
  3. shell十三问--shell教程
  4. 一件衣服95元,如果消费满300元,可以打八五折。输入购买衣服数,输出需要支付的金额。
  5. 手机安装Python
  6. 读书笔记-偷影子的人
  7. clickhouse副本和分片
  8. 阐述HTML语言的基本语法规则,信息组织学》考试试卷(A)试卷(一)
  9. Html —— 表白弹幕 特效(效果+代码)
  10. 万字长文!深度剖析《数据安全法》下多方数据协同应用和隐私计算发展趋势