短路清漆方法无需跳过内置的方法

在configurationVarnish 4时,我对vcl_recv内部的短路感兴趣,但是我不想跳过builtin.vcl(néedefault.vcl)VCL逻辑 。 例如,给定这个VCL伪代码:

 sub vcl_recv { if (somecondition1) { set some_thing; return (hash); # Return from cache if present, or fetch from the backend } if (somecondition2) { set some_other_thing; return (hash); # Return from cache if present, or fetch from the backend } // ... return (pass); # Skip cache, fetch from the backend } 

问题1

如果我在每个可能的代码path中调用return ,那么内置逻辑将被跳过 ,对吗?

问题2

有没有一种方法来格式化代码类似于上面,但没有跳过builtin.vcl逻辑? 我能看到的唯一方法是结合我的条件,布尔! 他们,并移动return (pass); 里面的巨人if

1)是的

2)返回的整个过程就是跳过代码的一部分,停止它通过不需要的代码运行(散列,传递,丢失)。 如果你需要运行它,要么
a)复制你需要执行的代码在返回之前
b)如果使用大量包装。

就个人而言,我倾向于复制和replace除了最基本的站点之外的所有内置vcl,我可以得到非常高的命中率(98%以上)。