subroutine & action - varnish
subroutine, code section, called in the flow, manipulate http header and other things,
action, indicate the next step, used inside subroutine, in format "return (action);" ,
see: https://www.varnish-cache.org/docs/3.0/reference/vcl.html#subroutines
------
format of subroutine
sub xxx {
...
return (action);
}
------
call a subrouine
format:
call xxx;
what we do:
we just re-define subroutine logic, it will be used in the flow automatically,
------
terminate of subroutine
use:
return(action);
'action' is the result which indicate the next step,
------
multi subroutine
if more than one subroutine with the same name is defined, they will be concated into a single subroutine in the order defined,
------
action
actions:
* error code [reason]
return error with specified reason, and abandon the request,
* pass
switch to pass mode,
if current subroutine is not vcl_pass, control will be pass to vcl_pass,
* pipe
switch to pipe mode,
if current subroutine is not vcl_pipe, control will be pass to vcl_pipe,
* lookup
lookup the requested object in the cache,
if found, control will be pass to vcl_hit, otheriwse to vcl_miss,
* deliver
deliver data to client,
if current subroutine is not vcl_deliver, control will be pass to vcl_deliver,
* restart
restart the request, and increase the restart counter, if the counter > max_restarts, an error will be send,
* fetch
retrieve the requested object from the backend,
if current subroutine is not vcl_fetch, control will be pass to vcl_fetch,
* ok
means ok, used in vcl_init & vcl_fini,
* hit_for_pass
used in vcl_fetch,
create a hit_for_pass object, set the object's ttl to the current value of beresp.tll,
current request will be handled by vcl_deliver,
but subsequence request will go directly to vcl_pass according to hit_for_pass object, means use vcl_pass and cache will not be used until the hit_for_pass object's ttl expired,
*
return the same action:
if a subroutine return a action the same as it self, that means the request is already proceed and finished in this way,
e.g.
in vcl_pipe(), return (pipe); , means request is proceed by the way pipe,
------
subroutines
* vcl_init
* vcl_recv
* vcl_pipe
* vcl_pass
* vcl_hash
* vcl_hit
* vcl_miss
* vcl_fetch
* vcl_deliver
* vcl_error
* vcl_fini
------
vcl_init
for init, called before any request come,
possible action:
* ok
vcl will go on
*
------
vcl_recv
called when request is received and parsed,
decide:
* whether to serve this request
* how to do it
* which backend to use
possible action:
* error code
* pass
* pipe
* lookup
*
------
vcl_pipe
request is passed to backend, varnish act just like a pipe between client & backend for furture data until the connection is closed,
possible action:
* error code
* pipe
indicate proceed & finished in pipe mode,
*
------
vcl_pass
similar as vcl_pipe, but the response from backend don't enter cache, means the response will not be cached,
the subsequence request of the same connection is proceed normally,
possible action:
* error code
* pass
indicate proceed & finished in pipe mode,
* restart
*
------
vcl_hash
add data to hash,
call hash_data() to add a data,
possible action:
* hash
Proceed,
*
------
vcl_hit
called after a cache is found in lookup,
possible action:
* deliver
* error code
* pass
* restart
*
------
vcl_miss
called after a cache not found in lookup,
decide:
* whether to attempt to retrieve the document from backend,
* which backend to use
possible action:
* error code
* pass
* fetch
------
vcl_fetch
called after a document is fetched from backend,
possible action:
* deliver
add object to cache, then deliver it,
* error code
* hit_for_pass
* restart
*
------
vcl_deliver
called before a object is deliver to the client,
possible action:
* deliver
deliver object to client,
* error code
* restart
*
------
vcl_error
called when an error occur,
possible action:
* deliver
deliver the error to client,
* restart
*
------
vcl_fini
clean up VCL, called after all request have exited VCL,
possible action:
* ok
vcl will be discarded,
*
------
分享到:
相关推荐
在"第十五章 用户自定义材料文件_subroutine_ls-dyna_用户子程序.rar"中,包含了示例代码和指导文档,帮助用户了解如何编写和集成这些子程序。这些示例可能涵盖从简单的线性弹性材料到复杂的塑性变形模型。用户可以...
标题中的"An Abaqus UHARD subroutine"指的是Abaqus软件中的一个用户自定义硬化(User-Defined Hardening,简称UHARD)子程序。Abaqus是Dassault Systemes公司开发的一个广泛使用的非线性有限元分析软件,它允许用户...
在LS-DYNA这款强大的非线性有限元分析软件中,用户自定义材料(User-Defined Materials, UDMs)是实现复杂材料行为建模的关键工具。这些自定义材料通过用户子程序实现,允许工程师根据实际工程问题的需求,定义材料...
bufbyte = A204 bufword = A205 start = 0100 exit = 010E subroutine = A200 ^L [root@localhost asm80]# more a.hex :0F010000160A0E0B3E00CD00A200C30E010076C2 :0DA20000808100C90101000200030004007C :...
ABAQUS扩展子程序应用,实例学习,仅供参考
通知事项 任何Rails应用程序的可安装通知。 例子: 安装 $ bundle add notifications 现在,您的Rails应用程序中有一个通知生成器: $ rails g notifications:install 如果需要自定义视图和控制器,则可以生成...
- UMAT子程序的基本结构和必需的子函数,如SUBROUTINE UMAT。 - 如何处理输入和输出参数,以及如何与ABAQUS的主求解器进行通信。 - 示例代码,展示如何实现常见的材料模型,如线弹性、塑性、蠕变等。 - 错误处理和...
【标题】"An efficient subroutine VUMAT_subroutine_vumat_ABAQUS_" 是一个专为ABAQUS软件设计的高效且稳健的用户自定义材料子程序(User-Defined Material subroutine, 简称VUMAT)。VUMAT是ABAQUS中的一个重要...
ABAQUS user subroutine UMAT, 用于弹塑性计算
该压缩包中的"visco-plastic creep subroutine"很可能是一个用特定编程语言(如Fortran、C++或Python)编写的源代码文件,它可能包含了一系列数学方程和算法,用于模拟材料随时间的蠕变行为。这些方程通常基于蠕变...
总的来说,"abaqus drucker-prager UMAT subroutine_UMAT_druckerprager_drucker"是一个用于ABAQUS的用户自定义子程序,它实现了Drucker-Prager准则,用于模拟岩石等材料在非线性条件下的力学行为。通过这个子程序,...
jc模型中的vumat子程序,abaqus中开发
C----------------------------------------------------------------------- program runocc C----------------------------------------------------------------------- c C OCCAM 2.0: Steven Constable IGPP/...
在ABAQUS这一强大的有限元分析软件中,用户可以通过编写自定义材料子程序(VUMAT)来模拟复杂的材料行为,以应对标准材料库无法满足的工程需求。本压缩包"VUMAT-J2.rar"提供了一个专为显式分析设计的J2等向强化模型...
#### User Subroutine - 最后,RecurDyn还支持用户自定义子程序的功能。通过编写自定义子程序,用户可以实现特定的计算任务或算法,进一步扩展软件的功能边界。 综上所述,RecurDyn不仅具备强大的基本功能,而且还...
3. **CALL (Subroutine Call):** 调用子程序,将当前 PC 的值压入堆栈,并跳转到指定地址。 - 示例:`CALL K PC + 1 -> [SP] (PAGE,K) -> PC 1SubroutineCall` 4. **DISI (Disable Interrupts):** 禁用中断。 - ...
- 计算阶段(如SUBROUTINE UMAT或VUMAT)进行实际的计算,包括应力-应变关系、应变率等。 - 结束阶段(如SUBROUTINE UEND)进行清理和资源释放。 4. 输入输出处理: - 用户子程序通过调用ABAQUS内部函数获取和...
abaqus 编写USDFLD用户子程序指导