歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> varnish 4.0官方文檔翻譯 VCL objects/actions

varnish 4.0官方文檔翻譯 VCL objects/actions

日期:2017/2/27 15:48:31   编辑:Linux教程

Request and response VCL objects

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

req

The 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對象做很多事。


bereq

The backend request object. Varnish contructs this before sending it to the backend. It is based on the req object.
後端請求對象。varnish在發送請求到後端之前構建這個對象。它基於req對象。


beresp

The 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對象。


resp

The HTTP response right before it is delivered to the client. It is typically modified in vcl_deliver.
傳遞給客戶端響應之前的response對象。通常在vcl_deliver中修改。


obj

The object as it is stored in cache. Read only.
存儲在緩存中的對象。 只讀。

actions

最常見的動作return這些:

pass

When 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中返回。

hash
When 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? benc

Pipe 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)。

deliver
Deliver the object to the client. Usually returned from vcl_backend_response.
傳遞對象給客戶端。通常在vcl_backend_response中return。

restart
Restart processing of the request. You can restart the processing of the whole transaction. Changes to the req object are retained.
重新對請求進行處理。你可以在整個請求處理的階段重啟。更改過的req對象將被保留。

retry
Retry 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。
Copyright © Linux教程網 All Rights Reserved