{"id":7358,"date":"2013-01-11T12:00:54","date_gmt":"2013-01-11T03:00:54","guid":{"rendered":"http:\/\/fukata.org\/?p=7358"},"modified":"2017-08-11T22:58:47","modified_gmt":"2017-08-11T22:58:47","slug":"i-want-on_connect-perl-redis","status":"publish","type":"post","link":"https:\/\/blog.fukata.org\/archives\/7358\/","title":{"rendered":"Perl\u306eRedis.pm\u306bon_connect\u304c\u6b32\u3057\u3044"},"content":{"rendered":"

\u73fe\u5728\u3001Mojolicious::Plugin::Session::Store::Redis\u3092\u4f7f\u3063\u3066\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u3092\u3057\u3066\u3044\u308b\u3093\u3067\u3059\u304c\u3001\u4f9d\u5b58\u3057\u3066\u3044\u308bRedis\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u5834\u5408\u3001select\u306a\u3069\u3057\u3066\u3044\u305f\u5834\u5408\u3001\u518d\u30b3\u30cd\u30af\u30c8\u6642\u306b\u306f\u7dad\u6301\u3057\u3066\u3082\u3089\u3048\u305a\u30010\u306b\u623b\u3063\u3066\u3057\u307e\u3046\u3002<\/p>\n

\u305d\u306e\u305f\u3081\u3001\u73fe\u72b6\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306bping\u304c\u6210\u529f\u3057\u305f\u969b\u306b\u6bce\u56deselect\u3092\u884c\u3046\u3088\u3046\u306b\u3057\u3066\u3044\u308b\u3002\u305f\u3060\u3001\u3053\u308c\u3060\u3068get\u6642\u306b\u63a5\u7d9a\u304c\u5207\u308c\u305f\u5834\u5408\u306b\u306f\u5bfe\u5fdc\u51fa\u6765\u306a\u3044\u306e\u3067\u5168\u4f53\u3092\u30e9\u30c3\u30d7\u3059\u308b\u306a\u3069\u3059\u308b\u5fc5\u8981\u304c\u51fa\u3066\u304d\u305f\u308a\u3001\u9762\u5012\u306a\u4e8b\u306b\u306a\u308a\u305d\u3046\u3002<\/p>\n

<\/p>\n

\r\nif ( $redis->ping ) {\r\n    $redis->select($dbidx);\r\n}\r\nmy $hoge = $redis->get('hoge');\r\n<\/pre>\n

\u4e0b\u8a18\u3067\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308bon_connect\u304c\u3042\u308c\u3070\u3001\u63a5\u7d9a\u5b8c\u4e86\u6642\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u5b9a\u7fa9\u3067\u304d\u308b\u306e\u3067\u3001\u305d\u3053\u3067select\u306a\u3069\u3057\u3066\u3042\u3052\u308c\u3070\u5168\u3066\u306e\u5834\u5408\u3067\u5bfe\u5fdc\u304c\u51fa\u6765\u305d\u3046\u3002\u305f\u3060\u3001\u30b3\u30ec\u304c\u307e\u3060\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u3066\u3044\u306a\u3044\u3002<\/p>\n

melo\/perl-redis \u00b7 GitHub<\/a><\/p>\n

\u30ea\u30ea\u30fc\u30b9\u304c\u5f85\u3061\u9060\u3057\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u73fe\u5728\u3001Mojolicious::Plugin::Session::Store::Redis\u3092\u4f7f\u3063\u3066\u30bb\u30c3\u30b7\u30e7\u30f3\u7ba1\u7406\u3092\u3057\u3066\u3044\u308b\u3093\u3067\u3059\u304c\u3001\u4f9d\u5b58\u3057\u3066\u3044\u308bRedis\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u5834\u5408\u3001select\u306a\u3069\u3057\u3066\u3044\u305f\u5834\u5408 … \u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":2,"featured_media":9223372036854775807,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1980],"tags":[1017,984],"_links":{"self":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/7358"}],"collection":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/comments?post=7358"}],"version-history":[{"count":0,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/7358\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media\/9223372036854775807"}],"wp:attachment":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media?parent=7358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/categories?post=7358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/tags?post=7358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}