{"id":400,"date":"2011-05-15T15:47:11","date_gmt":"2011-05-15T06:47:11","guid":{"rendered":"http:\/\/blog.xcir.net\/?p=400"},"modified":"2011-05-15T15:54:30","modified_gmt":"2011-05-15T06:54:30","slug":"varnishcache3-0beta1%e3%81%a7%e3%81%aevcl%e3%81%ae%e8%a8%98%e6%b3%95%e5%a4%89%e6%9b%b4","status":"publish","type":"post","link":"https:\/\/blog.xcir.net\/?p=400","title":{"rendered":"VarnishCache3.0beta1\u3067\u306evcl\u306e\u8a18\u6cd5\u5909\u66f4"},"content":{"rendered":"<p>3.0beta1\u3067\u306f\u7d50\u69cbVCL\u306e\u8a18\u6cd5\u304c\u5909\u66f4\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u8ffd\u52a0\u8981\u7d20\u306f\u307e\u305f\u5225\u8a18\u4e8b\u3067\u66f8\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u304c\u4e0b\u4f4d\u4e92\u63db\u6027\u306e\u306a\u3044\u5909\u66f4\u304c\u7d50\u69cb\u3042\u308a\u307e\u3059\u306e\u3067\u7e8f\u3081\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n<!--more--><br \/>\n\u4e00\u5fdc\u7db2\u7f85\u3057\u3066\u308b\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u601d\u3046\u306e\u3067\u3059\u304c\u629c\u3051\u304c\u3042\u3063\u305f\u3089\u6559\u3048\u3066\u3082\u3089\u3048\u308b\u3068\u3042\u308a\u304c\u305f\u3044\u3067\u3059\u3002<\/p>\n<h2>ESI\u51e6\u7406\u3092\u884c\u3046\u969b\u306e\u6307\u5b9a\u65b9\u6cd5<\/h2>\n<p>\u4eca\u307e\u3067\u306fesi;\u3067\u3057\u305f\u304cberesp.do_esi=true;\u306b\u5909\u308f\u308a\u307e\u3057\u305f\u3002<\/p>\n<h3>2.1.X<\/h3>\n<pre class=\"brush: c; \">\n\r\nsub vcl_fetch {\r\n    if (req.url == &quot;\/test.html&quot;) {\r\n       esi; \/* ESI\u51e6\u7406\u3092\u884c\u3046               *\/\r\n       set obj.ttl = 24 h;       \/* \u30ad\u30e3\u30c3\u30b7\u30e5\u4fdd\u6301\u6642\u9593\u3092\u8a2d\u5b9a\uff0824\u6642\u9593\uff09  *\/\r\n    } elseif (req.url == &quot;\/cgi-bin\/date.cgi&quot;) {\r\n       set obj.ttl = 1m;         \/* include\u3059\u308bHTML\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u4fdd\u6301\u6642\u9593\u3092\u8a2d\u5b9a\uff081\u5206\uff09        *\/\r\n    }\r\n}\r\n\n<\/pre>\n<h3>3.0<\/h3>\n<pre class=\"brush: c; \">\n\r\nsub vcl_fetch {\r\n    if (req.url == &quot;\/test.html&quot;) {\r\n       set beresp.do_esi = true; \/* ESI\u51e6\u7406\u3092\u884c\u3046               *\/\r\n       set obj.ttl = 24 h;       \/* \u30ad\u30e3\u30c3\u30b7\u30e5\u4fdd\u6301\u6642\u9593\u3092\u8a2d\u5b9a\uff0824\u6642\u9593\uff09  *\/\r\n    } elseif (req.url == &quot;\/cgi-bin\/date.cgi&quot;) {\r\n       set obj.ttl = 1m;         \/* include\u3059\u308bHTML\u306e\u30ad\u30e3\u30c3\u30b7\u30e5\u4fdd\u6301\u6642\u9593\u3092\u8a2d\u5b9a\uff081\u5206\uff09        *\/\r\n    }\r\n}\r\n\n<\/pre>\n<h2>obj.cacheable,beresp.cacheable\u304c\u5ec3\u6b62\u3055\u308c\u307e\u3057\u305f<\/h2>\n<p>\u30ad\u30e3\u30c3\u30b7\u30e5\u53ef\u80fd\u304b\u306e\u5224\u5b9a\u306fberesp.ttl\u3068beresp.grace\u3067\u306e\u307f\u5224\u5b9a\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>vcl_fetch\u5185\u3067\u306ereturn(pass)\u304creturn(hit_for_pass)\u306b\u5909\u66f4\u3055\u308c\u307e\u3057\u305f<\/h2>\n<p>vcl_recv\u3068vcl_fetch\u306epass\u52d5\u4f5c\u304c\u53b3\u5bc6\u306b\u306f\u9055\u3046\u305f\u3081\u540d\u524d\u3092\u5909\u66f4\u3055\u308c\u307e\u3057\u305f\u3002<br \/>\nvcl_recv\u306e\u65b9\u306f\u5909\u308f\u3063\u3066\u307e\u305b\u3093\u3002<\/p>\n<h3>2.1.X<\/h3>\n<pre class=\"brush: c; \">\n\r\nsub vcl_fetch {\r\n return(pass);\r\n}\r\n\n<\/pre>\n<h3>3.0<\/h3>\n<pre class=\"brush: c; \">\n\r\nsub vcl_fetch {\r\n return(hit_for_pass);\r\n}\r\n\n<\/pre>\n<h2>hash\u306e\u6307\u5b9a\u306e\u4ed5\u65b9\u304c\u5909\u308f\u308a\u307e\u3057\u305f<\/h2>\n<p>hash_data(value)\u306b\u5909\u308f\u308a\u307e\u3057\u305f\u3002<\/p>\n<h3>2.1.X<\/h3>\n<pre class=\"brush: c; \">\n\r\nreq.hash += value;\r\n\n<\/pre>\n<h3>3.0<\/h3>\n<pre class=\"brush: c; \">\n\r\nhash_data(value);\r\n\n<\/pre>\n<h2>\u6587\u5b57\u5217\u306e\u7d50\u5408\u306e\u4ed5\u65b9\u304c\u5909\u308f\u308a\u307e\u3057\u305f<\/h2>\n<p>\u7d50\u5408\u306b+\u3092\u5229\u7528\u3059\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<h3>2.1.X<\/h3>\n<pre class=\"brush: c; \">\n\r\nreq.url&quot;AAA&quot;\r\n\n<\/pre>\n<h3>3.0<\/h3>\n<pre class=\"brush: c; \">\n\r\nreq.url+&quot;AAA&quot;\r\n\n<\/pre>\n<h2>log\u30e1\u30bd\u30c3\u30c9\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u4f7f\u3048\u306a\u304f\u306a\u308a\u307e\u3057\u305f<\/h2>\n<p>Varnish Module(VMOD)\u306estd\u3092\u5229\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>2.1.X<\/h3>\n<pre class=\"brush: c; \">\n\r\nsub vcl_recv{\r\n log req.url;\r\n}\r\n\n<\/pre>\n<h3>3.0<\/h3>\n<pre class=\"brush: c; \">\n\r\nimport std;\r\nsub vcl_recv{\r\n std.log(req.url);\r\n}\r\n\n<\/pre>\n<h2>\u6587\u5b57\u5217\u4e2d\u306e%\u306b\u3088\u308b\u6587\u5b57\u5217\u30a8\u30b9\u30b1\u30fc\u30d7\u3092\u89e3\u91c8\u3057\u306a\u304f\u306a\u308a\u307e\u3057\u305f<\/h2>\n<h3>2.1.X<\/h3>\n<pre class=\"brush: plain; \">\n\r\n\u5165\u529b\r\nlog &quot;AAABBB:%67%67%67%67%67%67%67%67&quot;;\r\n\u51fa\u529b\r\n13 VCL_Log      c AAABBB:gggggggg\r\n\n<\/pre>\n<h3>3.0<\/h3>\n<pre class=\"brush: plain; \">\n\r\n\u5165\u529b\r\nstd.log(&quot;AAABBB:%67%67%67%67%67%67%67%67&quot;);\r\n\u51fa\u529b\r\n12 VCL_Log      c AAABBB:%67%67%67%67%67%67%67%67\r\n\n<\/pre>\n<h2>purge()\u304cban()\u306b\u306a\u308a\u307e\u3057\u305f<\/h2>\n<h3>2.1.X<\/h3>\n<pre class=\"brush: c; \">\n\r\npurge(&quot;req.http.host == &quot; req.http.host\r\n                      &quot;&amp;amp;amp;amp;&amp;amp;amp;amp; req.url == &quot; req.url);\r\n\n<\/pre>\n<h3>3.0<\/h3>\n<pre class=\"brush: c; \">\n\r\nban(&quot;req.http.host == &quot; + req.http.host +\r\n                      &quot;&amp;amp;amp;amp;&amp;amp;amp;amp; req.url == &quot;+ req.url);\r\n\n<\/pre>\n<p>&#8212;<br \/>\n\u3055\u3059\u304c\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u3068\u3044\u3046\u3079\u304d\u304b\u7d50\u69cb\u5909\u308f\u3063\u3066\u307e\u3059\u306d\u30fb\u30fb\u30fb<\/p>\n<div class='wp_social_bookmarking_light'>        <div class=\"wsbl_hatena\"><a href='\/\/b.hatena.ne.jp\/add?mode=confirm&url=https%3A%2F%2Fblog.xcir.net%2F%3Fp%3D400&title=VarnishCache3.0beta1%E3%81%A7%E3%81%AEvcl%E3%81%AE%E8%A8%98%E6%B3%95%E5%A4%89%E6%9B%B4' title='\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='https:\/\/blog.xcir.net\/wp-content\/plugins\/wp-social-bookmarking-light\/public\/images\/hatena.gif' alt='\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0' title='\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0' width='16' height='12' class='wp_social_bookmarking_light_img' \/><\/a><\/div>        <div class=\"wsbl_hatena_users\"><a href='\/\/b.hatena.ne.jp\/entry\/https:\/\/blog.xcir.net\/?p=400' title='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - VarnishCache3.0beta1\u3067\u306evcl\u306e\u8a18\u6cd5\u5909\u66f4' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='\/\/b.hatena.ne.jp\/entry\/image\/https:\/\/blog.xcir.net\/?p=400' alt='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - VarnishCache3.0beta1\u3067\u306evcl\u306e\u8a18\u6cd5\u5909\u66f4' title='\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af - VarnishCache3.0beta1\u3067\u306evcl\u306e\u8a18\u6cd5\u5909\u66f4'   class='wp_social_bookmarking_light_img' \/><\/a><\/div>        <div class=\"wsbl_facebook\"><a href='http:\/\/www.facebook.com\/share.php?u=https%3A%2F%2Fblog.xcir.net%2F%3Fp%3D400&t=VarnishCache3.0beta1%E3%81%A7%E3%81%AEvcl%E3%81%AE%E8%A8%98%E6%B3%95%E5%A4%89%E6%9B%B4' title='Facebook \u306b\u30b7\u30a7\u30a2' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='https:\/\/blog.xcir.net\/wp-content\/plugins\/wp-social-bookmarking-light\/public\/images\/facebook.png' alt='Facebook \u306b\u30b7\u30a7\u30a2' title='Facebook \u306b\u30b7\u30a7\u30a2' width='16' height='16' class='wp_social_bookmarking_light_img' \/><\/a><\/div>        <div class=\"wsbl_linkedin\"><a href='\/\/www.linkedin.com\/shareArticle?mini=true&url=https%3A%2F%2Fblog.xcir.net%2F%3Fp%3D400&title=VarnishCache3.0beta1%E3%81%A7%E3%81%AEvcl%E3%81%AE%E8%A8%98%E6%B3%95%E5%A4%89%E6%9B%B4' title='LinkedIn \u306b\u30b7\u30a7\u30a2' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='https:\/\/blog.xcir.net\/wp-content\/plugins\/wp-social-bookmarking-light\/public\/images\/linkedin.png' alt='LinkedIn \u306b\u30b7\u30a7\u30a2' title='LinkedIn \u306b\u30b7\u30a7\u30a2' width='16' height='16' class='wp_social_bookmarking_light_img' \/><\/a><\/div>        <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/blog.xcir.net\/?p=400\" data-text=\"VarnishCache3.0beta1\u3067\u306evcl\u306e\u8a18\u6cd5\u5909\u66f4\" data-lang=\"ja\">Tweet<\/a><\/div><\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>3.0beta1\u3067\u306f\u7d50\u69cbVCL\u306e\u8a18\u6cd5\u304c\u5909\u66f4\u3055\u308c\u3066\u3044\u307e\u3059\u3002 \u8ffd\u52a0\u8981\u7d20\u306f\u307e\u305f\u5225\u8a18\u4e8b\u3067\u66f8\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u304c\u4e0b\u4f4d\u4e92\u63db\u6027\u306e\u306a\u3044\u5909\u66f4\u304c\u7d50\u69cb\u3042\u308a\u307e\u3059\u306e\u3067\u7e8f\u3081\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[5,20,16],"class_list":["post-400","post","type-post","status-publish","format-standard","hentry","category-3","tag-varnish","tag-varnish3-0beta1","tag-vcl","category-3-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/400","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=400"}],"version-history":[{"count":10,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/400\/revisions"}],"predecessor-version":[{"id":410,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=\/wp\/v2\/posts\/400\/revisions\/410"}],"wp:attachment":[{"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.xcir.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}