{"id":72,"date":"2022-07-31T21:27:24","date_gmt":"2022-07-31T12:27:24","guid":{"rendered":"http:\/\/www.cybergarage.org\/memo\/?p=72"},"modified":"2024-02-03T21:28:47","modified_gmt":"2024-02-03T12:28:47","slug":"redis-resp-protocol","status":"publish","type":"post","link":"https:\/\/www.cybergarage.org\/memo\/redis-resp-protocol\/","title":{"rendered":"Redis \u30d7\u30ed\u30c8\u30b3\u30eb\u5b9f\u88c5\u8abf\u67fb &#8211; RESP\u306e\u8ab2\u984c\u3068\u73fe\u72b6\u306b\u3064\u3044\u3066"},"content":{"rendered":"<p>Redis\u306f\u3001\u30a4\u30f3\u30e1\u30e2\u30ea\u306e\u30ad\u30fc\u30d0\u30ea\u30e5\u30fc\u30b9\u30c8\u30a2\u3068\u3057\u30662009\u5e74\u306b\u767b\u5834\u3057\u3001\u73fe\u5728\u3067\u3082\u6d3b\u767a\u306b\u6a5f\u80fd\u62e1\u5f35\u304c\u7d99\u7d9a\u3055\u308c\u3066\u3044\u308b\u30d7\u30ed\u30c0\u30af\u30c8\u3067\u3059\u3002\u7279\u306b\u30012020\u5e74\u306b\u767b\u5834\u3057\u305fRedis 6\u7cfb\u3067\u306f\u3001Redi\u306e\u901a\u4fe1\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u3042\u308bRESP (REdis Serialization Protocol)<a href=\"https:\/\/redis.io\/docs\/reference\/protocol-spec\/\">[1]<\/a>\u304cRESP 3<a href=\"https:\/\/github.com\/antirez\/RESP3\/blob\/master\/spec.md\">[2]<\/a>\u3068\u3057\u3066\u5237\u65b0\u3055\u308c\u3001\u5927\u5e45\u306a\u6a5f\u80fd\u62e1\u5f35\u304c\u5b9f\u73fe\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u672c\u5bb6\u306eRedis\u81ea\u4fe1\u3082\u9032\u5316\u3092\u7d9a\u3051\u3066\u3044\u307e\u3059\u304c\u3001\u6700\u8fd1\u3067\u306fRedis\u3068\u4e92\u63db\u6027\u306e\u3042\u308bRESP\u30d7\u30ed\u30c8\u30b3\u30eb\u306b\u5bfe\u5fdc\u3057\u305f\u5927\u898f\u6a21\u306aRedis\u4e92\u63db\u30d7\u30ed\u30c0\u30af\u30c8\u304c\u76f8\u6b21\u3044\u3067\u767b\u5834\u3057\u3066\u3044\u307e\u3059<a href=\"https:\/\/aws.amazon.com\/jp\/memorydb\/\">[4]<\/a><a href=\"https:\/\/www.publickey1.jp\/blog\/22\/redis25dragonfly2022.html\">[5]<\/a>\u3002\u4eca\u56de\u306f\u3001Redis\u4e92\u63db\u30d7\u30ed\u30c0\u30af\u30c8\u306e\u4e92\u63db\u6027\u62c5\u4fdd\u306e\u57fa\u672c\u3068\u3082\u306a\u308b\u3001RESP (REdis Serialization Protocol)<a href=\"https:\/\/redis.io\/docs\/reference\/protocol-spec\/\">[1]<\/a>\u306e\u901a\u4fe1\u30d7\u30ed\u30c8\u30b3\u30eb\u3092\u4e2d\u5fc3\u306b\u3001\u5b9f\u88c5\u4e0a\u306e\u5229\u70b9\u306a\u3069\u3084\u8ab2\u984c\u3092\u8e0f\u307e\u3048\u3066\u89e3\u8aac\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.cybergarage.org\/memo\/redis-resp-protocol\/#RESP_REdis_Serialization_Protocol%E3%81%AE%E6%A6%82%E8%A6%81\" >RESP (REdis Serialization Protocol)\u306e\u6982\u8981<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.cybergarage.org\/memo\/redis-resp-protocol\/#RESP%E3%81%AE%E8%AA%B2%E9%A1%8C\" >RESP\u306e\u8ab2\u984c<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.cybergarage.org\/memo\/redis-resp-protocol\/#RESP_2%E3%81%AB%E3%82%88%E3%82%8B%E3%83%87%E3%83%BC%E3%82%BF%E5%9E%8B%E3%81%AE%E9%99%90%E5%AE%9A%E6%80%A7\" >RESP 2\u306b\u3088\u308b\u30c7\u30fc\u30bf\u578b\u306e\u9650\u5b9a\u6027<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.cybergarage.org\/memo\/redis-resp-protocol\/#RESP_3%E3%81%AB%E3%82%88%E3%82%8B%E8%A6%8F%E5%AE%9A\" >RESP 3\u306b\u3088\u308b\u898f\u5b9a<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.cybergarage.org\/memo\/redis-resp-protocol\/#%E3%83%97%E3%83%AD%E3%83%88%E3%82%B3%E3%83%AB%E3%81%AE%E9%9D%9E%E5%8A%B9%E7%8E%87%E6%80%A7\" >\u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u975e\u52b9\u7387\u6027<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.cybergarage.org\/memo\/redis-resp-protocol\/#%E6%9C%80%E5%BE%8C%E3%81%AB\" >\u6700\u5f8c\u306b<\/a><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"RESP_REdis_Serialization_Protocol%E3%81%AE%E6%A6%82%E8%A6%81\"><\/span>RESP (REdis Serialization Protocol)\u306e\u6982\u8981<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>RESP\u306f\u300c\u5b9f\u88c5\u304c\u7c21\u5358\u300d\u300c\u89e3\u6790\u304c\u9ad8\u901f\u300d\u300c\u30d2\u30e5\u30fc\u30de\u30f3\u30ea\u30fc\u30c0\u30d6\u30eb\u300d\u3092\u8a2d\u8a08\u601d\u60f3<a href=\"https:\/\/redis.io\/docs\/reference\/protocol-spec\/\">[1]<\/a>\u3068\u3059\u308b\u901a\u4fe1\u30d7\u30ed\u30c8\u30b3\u30eb\u4ed5\u69d8\u3067\u3059\u3002\u901a\u4fe1\u30d1\u30b1\u30c3\u30c8\u306e\u8d77\u70b9\u3068\u306a\u308b\u5171\u901a\u30d8\u30c3\u30c0\u306f\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u7a2e\u5225\u3092\u793a\u30591\u30d0\u30a4\u30c8\u306e\u307f\u3067\u3001CRLF\u3092\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u7d42\u7aef\u3068\u3059\u308b\u3001\u975e\u5e38\u306b\u5358\u7d14\u306a\u4ed5\u69d8\u3067\u3059\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u9805\u76ee<\/th>\n<th>\u30c7\u30fc\u30bf\u578b<\/th>\n<th>\u88dc\u8db3<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u30e1\u30c3\u30bb\u30fc\u30b8\u8b58\u5225\u5b50<\/td>\n<td>byte\\&lt;1><\/td>\n<td>\u3000'+', '-', ':' \u306a\u3069<\/td>\n<\/tr>\n<tr>\n<td>\u30e1\u30c3\u30bb\u30fc\u30b8\u90e8<\/td>\n<td>-<\/td>\n<td>\u3000\u30e1\u30c3\u30bb\u30fc\u30b8\u7a2e\u5225\u6bce\u306b\u898f\u5b9a<\/td>\n<\/tr>\n<tr>\n<td>\u30e1\u30c3\u30bb\u30fc\u30b8\u7d42\u7aef<\/td>\n<td>byte\\&lt;2><\/td>\n<td>CR LF (\u7701\u7565\u5316)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f8b\u3048\u3070\u3001Redis\u30b3\u30de\u30f3\u30c9\u304c\u6b63\u5e38\u306b\u5b9f\u884c\u3055\u308c\u305f\u3053\u3068\u3092\u793a\u3059\u5fdc\u7b54\u306f\u3001\u6587\u5b57\u5217\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u7a2e\u5225\u3092\u793a\u3059\u300c<code>+<\/code>\u300d\u304b\u3089\u958b\u59cb\u3055\u308c\u3001\u6210\u529f\u3092\u793a\u3059\u30e1\u30c3\u30bb\u30fc\u30b8\u6587\u5b57\u5217\u3067\u3042\u308b\u300c<code>OK<\/code>\u300d\u304cCRLF\u3067\u7d42\u7aef\u3055\u308c\u305f\u3082\u306e\u304c\u9001\u4fe1\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre><code>+OK\\r\\n<\/code><\/pre>\n<p>RESP\u306e\u30c7\u30fc\u30bf\u578b\u306f\u3001\u6587\u5b57\u5217\u8868\u73fe\u304c\u57fa\u672c\u3067\u3059\u3002RESP\u3067\u306f\u3001\u6570\u5024\u306b\u304a\u3044\u3066\u3082\u6587\u5b57\u5217\u3068\u3057\u3066\u8868\u73fe\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u300c\u30d2\u30e5\u30fc\u30de\u30f3\u30ea\u30fc\u30c0\u30d6\u30eb\u300d\u306e\u8a2d\u8a08\u601d\u60f3<a href=\"https:\/\/redis.io\/docs\/reference\/protocol-spec\/\">[1]<\/a>\u901a\u308a\u306b\u3001\u7c21\u5358\u306b\u76ee\u8996\u3067\u304d\u308b\u30c7\u30d0\u30c3\u30b0\u3057\u3084\u3059\u3044\u901a\u4fe1\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u3059\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"RESP%E3%81%AE%E8%AA%B2%E9%A1%8C\"><\/span>RESP\u306e\u8ab2\u984c<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>RESP\u306f\u3001\u672c\u5bb6\u306eRedis\u3084\u8fd1\u5e74\u306e\u76f8\u6b21\u3044\u3067\u767b\u5834\u3057\u3066\u3044\u308b\u5927\u898f\u6a21\u306aRedis\u4e92\u63db\u30d7\u30ed\u30c0\u30af\u30c8\u306e\u57fa\u76e4\u3068\u306a\u308b\u901a\u4fe1\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u3059\u3002\u4eca\u56de\u306f\u3001RESP\u4ed5\u69d8<a href=\"https:\/\/redis.io\/docs\/reference\/protocol-spec\/\">[1]<\/a><a href=\"http:\/\/antirez.com\/news\/125\">[3]<\/a>\u306e\u8abf\u67fb\u3084\u5b9f\u88c5<a href=\"https:\/\/github.com\/cybergarage\/go-redis\/\">[6]<\/a>\u3057\u3066\u307f\u3066\u6c17\u304c\u3064\u3044\u305f\u8ab2\u984c\u3092\u3001\u5f8c\u306eRESP 3\u8a2d\u8a08\u306e\u52d5\u6a5f\u3068\u306a\u3063\u305f\u8ab2\u984c<a href=\"http:\/\/antirez.com\/news\/125\">[3]<\/a>\u3068\u5408\u308f\u305b\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"RESP_2%E3%81%AB%E3%82%88%E3%82%8B%E3%83%87%E3%83%BC%E3%82%BF%E5%9E%8B%E3%81%AE%E9%99%90%E5%AE%9A%E6%80%A7\"><\/span>RESP 2\u306b\u3088\u308b\u30c7\u30fc\u30bf\u578b\u306e\u9650\u5b9a\u6027<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>RESP 2\u4ed5\u69d8<a href=\"https:\/\/redis.io\/docs\/reference\/protocol-spec\/\">[1]<\/a>\u3067\u306f\u3001\u4ee5\u4e0b\u306e5\u7a2e\u985e\u306e\u30c7\u30fc\u30bf\u578b\u306e\u898f\u5b9a\u3057\u304b\u3042\u308a\u307e\u305b\u3093\u3002\u305d\u306e\u305f\u3081\u3001\u4efb\u610f\u306e\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u3084\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u578b\u3092\u8868\u73fe\u3059\u308b\u306b\u306f\u3001\u5b9f\u88c5\u4e0a\u3001\u6697\u9ed9\u7684\u306a\u5909\u63db\u3084\u898f\u5b9a\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u8b58\u5225\u5b50<\/th>\n<th>\u30c7\u30fc\u30bf\u578b<\/th>\n<th>\u66f8\u5f0f<\/th>\n<th>\u5099\u8003<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>+<\/td>\n<td>String<\/td>\n<td>\u6587\u5b57\u5217 + CRLF<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>-<\/td>\n<td>Error<\/td>\n<td>\u6587\u5b57\u5217 + CRLF<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>:<\/td>\n<td>Integer<\/td>\n<td>\u6570\u6587\u5b57\u5217 + CRLF<\/td>\n<td>10\u9032\u6570<\/td>\n<\/tr>\n<tr>\n<td>$<\/td>\n<td>Bulk String<\/td>\n<td>\u30d0\u30eb\u30af\u6587\u5b57\u9577 + CRLF + \u30d0\u30eb\u30af\u6587\u5b57 + CRLF<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>+<\/td>\n<td>Array<\/td>\n<td>\u914d\u5217\u6570 + CRLF + \u914d\u5217\u30c7\u30fc\u30bf<\/td>\n<td>\u5168\u30c7\u30fc\u30bf\u7a2e\u5225\u6307\u5b9a\u53ef (\u914d\u5217\u5165\u308c\u5b50\u542b\u3080)\u3000<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f8b\u3048\u3070\u3001\u6d6e\u52d5\u5c0f\u6570\u70b9\u3092\u8868\u73fe\u3059\u308b\u306b\u306f\u6587\u5b57\u5217\u578b\u3068\u306e\u3001\u9023\u60f3\u914d\u5217(\u30de\u30c3\u30d7)\u578b\u3092\u8868\u73fe\u3059\u308b\u306b\u306f\u914d\u5217\u578b\u3068\u306e\u3001\u6697\u9ed9\u7684\u306f\u5909\u63db\u306e\u898f\u5b9a\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u3002Redis\u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u4f8b\u3068\u3057\u3066\u306f\u3001\u8907\u6570\u306e\u30ad\u30fc\u30d0\u30ea\u30e5\u30fc\u3092\u8a2d\u5b9a\u3059\u308b\u3001\u4ee5\u4e0b\u306eMSET\u30b3\u30de\u30f3\u30c9\u306f\u3001<\/p>\n<pre><code>MSET key1 &quot;Hello&quot; key2 &quot;World&quot;<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306eRESP\u30e1\u30c3\u30bb\u30fc\u30b8\u306b\u5909\u63db\u3055\u308c\u305f\u3082\u306e\u304c\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089\u30b5\u30fc\u30d0\u30fc\u3078\u9001\u4fe1\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><code>*5\\r\\n$4\\r\\mset\\r\\n$4\\r\\nkey1\\r\\n$7\\r\\n&quot;HELLO&quot;\\r\\n$4\\r\\nkey2\\r\\n$7\\r\\n&quot;World&quot;\\r\\n<\/code><\/pre>\n<p>MSET\u30b3\u30de\u30f3\u30c9\u306f\u3001\u9023\u60f3\u914d\u5217(\u30de\u30c3\u30d7)\u578b\u3092\u30ad\u30fc\u5024\u3001\u30d0\u30ea\u30e5\u30fc\u5024\u304c\u4ea4\u4e92\u306b\u73fe\u308c\u308b\u914d\u5217\u3068\u3057\u3066\u5909\u63db\u3055\u308c\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089\u30b5\u30fc\u30d0\u30fc\u3078\u9001\u4fe1\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"RESP_3%E3%81%AB%E3%82%88%E3%82%8B%E8%A6%8F%E5%AE%9A\"><\/span>RESP 3\u306b\u3088\u308b\u898f\u5b9a<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u4e0a\u8a18\u306b\u793a\u3057\u305f\u3001RESP 2\u4ed5\u69d8<a href=\"https:\/\/redis.io\/docs\/reference\/protocol-spec\/\">[1]<\/a>\u306e\u8ab2\u984c\u3092\u8e0f\u307e\u3048\u3066\u3001RESP 3\u4ed5\u69d8<a href=\"https:\/\/github.com\/antirez\/RESP3\/blob\/master\/spec.md\">[2]<\/a>\u3067\u306f\u3001\u4ee5\u4e0b\u306b\u793a\u3059\u65b0\u3057\u3044\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u3084\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u578b\u304c\u4ed5\u69d8\u3068\u3057\u3066\u898f\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u8b58\u5225\u5b50<\/th>\n<th>\u30c7\u30fc\u30bf\u578b<\/th>\n<th>\u66f8\u5f0f<\/th>\n<th>\u5099\u8003<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>-<\/td>\n<td>Null<\/td>\n<td>CRLF<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>,<\/td>\n<td>Double<\/td>\n<td>\u6d6e\u52d5\u5c0f\u6570\u8868\u73fe\u6587\u5b57\u5217  + CRLF<\/td>\n<td>10\u9032\u6570\u8868\u73fe\u3001inf\u306a\u3069<\/td>\n<\/tr>\n<tr>\n<td>#<\/td>\n<td>Boolean<\/td>\n<td>(t|f) + CRLF<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>!<\/td>\n<td>Blob Error<\/td>\n<td>\u30a8\u30e9\u30fc\u6587\u5b57\u9577 + CRLF + \u30a8\u30e9\u30fc\u6587\u5b57 + CRLF<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>=<\/td>\n<td>Verbatim String<\/td>\n<td>\u30d0\u30eb\u30af\u6587\u5b57\u9577 + CRLF + \u30d0\u30eb\u30af\u6587\u5b57 + CRLF<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>%<\/td>\n<td>Map<\/td>\n<td>\u30de\u30c3\u30d7\u6570 + CRLF + (\u30ad\u30fc\u30c7\u30fc\u30bf + \u5024\u30c7\u30fc\u30bf)*<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>~<\/td>\n<td>Set<\/td>\n<td>\u30bb\u30c3\u30c8\u6570 + CRLF + \u30bb\u30c3\u30c8\u30c7\u30fc\u30bf<\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Redis 6\u304b\u3089\u306eRESP 3<a href=\"http:\/\/antirez.com\/news\/125\">[3]<\/a>\u306e\u307f\u306b\u5bfe\u5fdc\u3059\u308b\u8a2d\u8a08\u7684\u306a\u65b9\u91dd\u3082\u3042\u308a\u307e\u3057\u305f\u304c\u3001\u6700\u7d42\u7684\u306b\u306f\u3001RESP 3\u306fRESP 2\u306e\u4e0a\u4f4d\u4e92\u63db\u6027\u3092\u610f\u8b58\u3057\u305f\u8a2d\u8a08\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001RESP\u3067\u5c0e\u5165\u3055\u308c\u305fMap(\u9023\u60f3\u914d\u5217)\u578b\u306f\u3001\u4e0a\u8a18\u306eRESP 2\u306eMSET\u306e\u4e8b\u4f8b\u3067\u3067\u6697\u9ed9\u7684\u306b\u914d\u5217\u30c7\u30fc\u30bf\u578b\u306b\u5909\u63db\u3055\u308c\u305f\u3082\u306e\u3068\u540c\u4e00\u306e\u8868\u73fe\u3067\u3059\u3002\u8b58\u5225\u5b50\u3053\u305d\u3001\u65b0\u305f\u306aMap\u578b\u8b58\u5225\u5b50(<code>%<\/code>)\u3092\u4e0e\u3048\u3089\u308c\u307e\u3057\u305f\u304c\u3001\u5f93\u6765\u306eRESP 2\u3067\u7528\u3044\u3089\u308c\u3066\u3044\u305f\u914d\u5217\u578b\u306b\u3088\u308bMap\u578b\u306e\u66f8\u5f0f\u304c\u8e0f\u8972\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E3%83%97%E3%83%AD%E3%83%88%E3%82%B3%E3%83%AB%E3%81%AE%E9%9D%9E%E5%8A%B9%E7%8E%87%E6%80%A7\"><\/span>\u30d7\u30ed\u30c8\u30b3\u30eb\u306e\u975e\u52b9\u7387\u6027<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>RESP 3\u4ed5\u69d8<a href=\"https:\/\/github.com\/antirez\/RESP3\/blob\/master\/spec.md\">[2]<\/a>\u306f\u3001RESP 2\u4ed5\u69d8<a href=\"https:\/\/redis.io\/docs\/reference\/protocol-spec\/\">[1]<\/a>\u306e\u6697\u9ed9\u7684\u306a\u4ed5\u69d8\u3092\u660e\u78ba\u5316\u3057\u305f\u5074\u9762\u304c\u3042\u308a\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u4e0a\u4f4d\u4e92\u63db\u6027\u3092\u91cd\u8996\u3057\u305f\u8a2d\u8a08\u306e\u305f\u3081\u3001\u5f93\u6765\u306eRESP 2\u4ed5\u69d8<a href=\"https:\/\/redis.io\/docs\/reference\/protocol-spec\/\">[1]<\/a>\u306e\u6b20\u70b9\u3082\u5f15\u304d\u7d99\u304c\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>RESP 2\u4ed5\u69d8<a href=\"https:\/\/redis.io\/docs\/reference\/protocol-spec\/\">[1]<\/a>\u306b\u306f\u3001RESP\u4ed5\u69d8\u306e\u5b9f\u88c5\u306e\u7c21\u5358\u3055\u3068\u3001\u9ad8\u901f\u6027\u3092\u793a\u3059\u4e8b\u4f8b\u3068\u3057\u3066\u3001\u4ee5\u4e0b\u306eC\u8a00\u8a9e\u306b\u3088\u308b\u30d1\u30fc\u30b9\u51e6\u7406\u306e\u5b9f\u88c5\u4f8b\u304c\u63b2\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><code>#include &lt;stdio.h&gt;\n\nint main(void) {\n    unsigned char *p = &quot;$123\\r\\n&quot;;\n    int len = 0;\n\n    p++;\n    while(*p != &#039;\\r&#039;) {\n        len = (len*10)+(*p - &#039;0&#039;);\n        p++;\n    }\n\n    \/* Now p points at &#039;\\r&#039;, and the len is in bulk_len. *\/\n    printf(&quot;%d\\n&quot;, len);\n    return 0;\n}<\/code><\/pre>\n<p>\u4e0a\u8a18\u4e8b\u4f8b\u306f\u3001\u6587\u5b57\u5217\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u7a2e\u5225\u3092\u793a\u3059\u300c<code>$<\/code>\u300d\u304b\u3089\u958b\u59cb\u3055\u308c\u305f10\u9032\u6570\u6587\u5b57\u5217\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u3001\u6574\u6570\u306b\u5909\u63db\u3059\u308b\u51e6\u7406\u3092\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u30d1\u30fc\u30b9\u958b\u59cb\u6642\u306b\u306f\u30e1\u30c3\u30bb\u30fc\u30b8\u90e8\u306e\u30d0\u30a4\u30c8\u6570\u304c\u4e0d\u660e\u306a\u305f\u3081\u30011\u30d0\u30a4\u30c8\u305a\u3064\u53d6\u5f97\u3057\u3066\u89e3\u91c8\u305b\u3056\u308b\u8ca0\u3048\u305a\u3001\u5b9f\u884c\u52b9\u7387\u3084\u901f\u5ea6\u9762\u3067\u306f\u52b9\u7387\u7684\u3068\u306f\u8a00\u3048\u307e\u305b\u3093\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u3001RESP\u3092\u30d9\u30fc\u30b9\u3068\u3059\u308bRedis\u30b5\u30fc\u30d0\u30fc\u306e\u30b3\u30de\u30f3\u30c9\u306f\u3001\u30d1\u30fc\u30b9\u958b\u59cb\u6642\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u90e8\u306e\u30d0\u30a4\u30c8\u6570\u3084\u500b\u6570\u304c\u8a8d\u8b58\u3067\u304d\u308b\u3001\u30d0\u30eb\u30af\u6587\u5b57\u5217(<code>$<\/code>)\u3084\u914d\u5217(<code>*<\/code>)\u3092\u4e3b\u4f53\u3068\u3057\u3066\u5b9f\u88c5\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306eRedis\u306eSET\u30b3\u30de\u30f3\u30c9\u306f\u3001<\/p>\n<pre><code>SET key value<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306eRESP\u30e1\u30c3\u30bb\u30fc\u30b8\u306b\u5909\u63db\u3055\u308c\u305f\u3082\u306e\u304c\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089\u30b5\u30fc\u30d0\u30fc\u3078\u9001\u4fe1\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><code>*3\\r\\n$3\\r\\nset\\r\\n$3\\r\\nkey\\r\\n$5\\r\\nvalue\\r\\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u3001C\u8a00\u8a9e\u3067\u306e\u5b9f\u88c5\u4f8b\u306b\u3042\u3063\u305f\u6587\u5b57\u5217\u30e9\u30a4\u30af\u306aCRLR\u3092\u7d42\u7aef\u3068\u3059\u308b\u901a\u5e38\u6587\u5b57\u5217(<code>$<\/code>)\u3068\u7570\u306a\u308a\u3001\u30d0\u30eb\u30af\u6587\u5b57\u5217(<code>$<\/code>)\u306fPascal\u6587\u5b57\u5217\u30e9\u30a4\u30af\u306b\u6700\u521d\u306b\u6587\u5b57\u5217\u30d0\u30a4\u30c8\u6570\u304c\u628a\u63e1\u3067\u304d\u308b\u305f\u3081\u4e00\u62ec\u3057\u3066\u306e\u8aad\u307f\u8fbc\u307f\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u305f\u3060\u3057\u3001\u30d0\u30eb\u30af\u6587\u5b57\u5217(<code>$<\/code>)\u3084\u914d\u5217(<code>*<\/code>)\u30e1\u30c3\u30bb\u30fc\u30b8\u5171\u306b\u3001\u6700\u521d\u306e\u500b\u6570\u3092\u793a\u3059\u6570\u5024\u306fCRLF\u3092\u7d42\u7aef\u3059\u308b\u4e0d\u5b9a\u578b\u306a\u6587\u5b57\u5217\u8868\u73fe\u3067\u3059\u3002RESP 2\u4ed5\u69d8<a href=\"https:\/\/redis.io\/docs\/reference\/protocol-spec\/\">[1]<\/a>\u306b\u306f\u300c\u30d0\u30a4\u30ca\u30ea\u30d7\u30ed\u30c8\u30b3\u30eb\u3068\u540c\u7b49\u306e\u6027\u80fd\u300d\u3068\u306e\u4e3b\u5f35\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u6570\u5024\u3092\u4f8b\u3048\u30704\u30d0\u30a4\u30c8\u3067\u8868\u73fe\u3059\u308b\u3088\u3046\u306a\u3001\u7d14\u7c8b\u306a\u30d0\u30a4\u30ca\u30ea\u30d7\u30ed\u30c8\u30b3\u30eb\u3068\u6bd4\u8f03\u3059\u308b\u3068\u3001\u975e\u52b9\u7387\u306a\u9762\u306f\u6b8b\u308a\u307e\u3059\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"%E6%9C%80%E5%BE%8C%E3%81%AB\"><\/span>\u6700\u5f8c\u306b<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u8fd1\u5e74\u3001Redis\u3068\u4e92\u63db\u6027\u306e\u3042\u308bRESP\u30d7\u30ed\u30c8\u30b3\u30eb\u306b\u5bfe\u5fdc\u3057\u305f\u5927\u898f\u6a21\u306aRedis\u4e92\u63db\u30d7\u30ed\u30c0\u30af\u30c8\u304c\u76f8\u6b21\u3044\u3067\u767b\u5834\u3057\u3066\u3044\u307e\u3059<a href=\"https:\/\/aws.amazon.com\/jp\/memorydb\/\">[4]<\/a><a href=\"https:\/\/www.publickey1.jp\/blog\/22\/redis25dragonfly2022.html\">[5]<\/a>\u3002\u4eca\u56de\u306e\u8a18\u4e8b\u3082\u3001\u305d\u306e\u767b\u5834\u306e\u80cc\u666f\u3092\u8abf\u67fb\u3057\u306a\u304c\u3089\u3001Redis\u4e92\u63db\u30b5\u30fc\u30d0\u30fc\u3092<code>go-redis<\/code><a href=\"https:\/\/github.com\/cybergarage\/go-redis\/\">[6]<\/a>\u3068\u3057\u3066\u8a66\u9a13\u7684\u306b\u5b9f\u88c5\u3057\u3066\u6c17\u304c\u3064\u3044\u305f\u70b9\u3092\u3001\u3044\u3063\u305f\u3093\u6574\u7406\u3057\u3066\u307e\u3068\u3081\u3066\u898b\u307e\u3057\u305f\u3002\u307e\u305f\u3001\u8abf\u67fb\u3084\u5b9f\u88c5\u3092\u9032\u3081\u308b\u4e2d\u3067\u6c17\u304c\u3064\u3044\u305f\u70b9\u304c\u3042\u308c\u3070\u3001\u3042\u3089\u305f\u3081\u3066\u6574\u7406\u3057\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/redis.io\/docs\/reference\/protocol-spec\/\">[1] RESP protocol spec | Redis<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/antirez\/RESP3\/blob\/master\/spec.md\">[2] RESP3 specification<\/a><\/li>\n<li><a href=\"http:\/\/antirez.com\/news\/125\">[3] Why RESP3 will be the only protocol supported by Redis 6 - <antirez><\/a><\/li>\n<li><a href=\"https:\/\/aws.amazon.com\/jp\/memorydb\/\">[4] Amazon MemoryDB for Redis<\/a><\/li>\n<li><a href=\"https:\/\/www.publickey1.jp\/blog\/22\/redis25dragonfly2022.html\">[5] Redis\u4e92\u63db\u306725\u500d\u9ad8\u901f\u3068\u3059\u308b\u300cDragonfly\u300d\u304c\u767b\u5834\u30022022\u5e74\u306e\u6700\u65b0\u6280\u8853\u3067\u30a4\u30f3\u30e1\u30e2\u30ea\u30c7\u30fc\u30bf\u30b9\u30c8\u30a2\u3092\u5b9f\u88c5 \uff0d Publickey<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/cybergarage\/go-redis\/\">[6] go-redis - Database framework for implementing a Redis compatible server using Go<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Redis\u306f\u3001\u30a4\u30f3\u30e1\u30e2\u30ea\u306e\u30ad\u30fc\u30d0\u30ea\u30e5\u30fc\u30b9\u30c8\u30a2\u3068\u3057\u30662009\u5e74\u306b\u767b\u5834\u3057\u3001\u73fe\u5728\u3067\u3082\u6d3b\u767a\u306b\u6a5f\u80fd\u62e1\u5f35\u304c\u7d99\u7d9a\u3055\u308c\u3066\u3044\u308b\u30d7\u30ed\u30c0\u30af\u30c8\u3067\u3059\u3002\u7279\u306b\u30012020\u5e74\u306b\u767b\u5834\u3057\u305fRedis 6\u7cfb\u3067\u306f\u3001Redi\u306e\u901a\u4fe1\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u3042\u308bRESP (REdis Serialization Protocol)[1]\u304cRESP 3[2]\u3068\u3057\u3066\u5237\u65b0\u3055\u308c\u3001\u5927\u5e45\u306a\u6a5f\u80fd\u62e1\u5f35\u304c\u5b9f\u73fe\u3055\u308c\u307e\u3057\u305f\u3002 \u672c\u5bb6\u306eRedis\u81ea\u4fe1\u3082\u9032\u5316\u3092\u7d9a\u3051\u3066\u3044\u307e\u3059\u304c\u3001\u6700\u8fd1\u3067\u306fRedis\u3068\u4e92\u63db\u6027\u306e\u3042\u308bRESP\u30d7\u30ed\u30c8\u30b3\u30eb\u306b\u5bfe\u5fdc\u3057\u305f\u5927\u898f\u6a21\u306aRedis\u4e92\u63db\u30d7\u30ed\u30c0\u30af\u30c8\u304c\u76f8\u6b21\u3044\u3067\u767b\u5834\u3057\u3066\u3044\u307e\u3059[4][5]\u3002\u4eca\u56de\u306f\u3001Redis\u4e92\u63db\u30d7\u30ed\u30c0\u30af\u30c8\u306e\u4e92\u63db\u6027\u62c5\u4fdd\u306e\u57fa\u672c\u3068\u3082\u306a\u308b\u3001RESP (REdis Serialization Protocol)[1]\u306e\u901a\u4fe1\u30d7\u30ed\u30c8\u30b3\u30eb\u3092\u4e2d\u5fc3\u306b\u3001\u5b9f\u88c5\u4e0a\u306e\u5229\u70b9\u306a\u3069\u3084\u8ab2\u984c\u3092\u8e0f\u307e\u3048\u3066\u89e3\u8aac\u3057\u3066\u307f\u307e\u3059\u3002 RESP (REdis Serialization Protocol)\u306e\u6982\u8981 RESP\u306f\u300c\u5b9f\u88c5\u304c\u7c21\u5358\u300d\u300c\u89e3\u6790\u304c\u9ad8\u901f\u300d\u300c\u30d2\u30e5\u30fc\u30de\u30f3\u30ea\u30fc\u30c0\u30d6\u30eb\u300d\u3092\u8a2d\u8a08\u601d\u60f3[1]\u3068\u3059\u308b\u901a\u4fe1\u30d7\u30ed\u30c8\u30b3\u30eb\u4ed5\u69d8\u3067\u3059\u3002\u901a\u4fe1\u30d1\u30b1\u30c3\u30c8\u306e\u8d77\u70b9\u3068\u306a\u308b\u5171\u901a\u30d8\u30c3\u30c0\u306f\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u7a2e\u5225\u3092\u793a\u30591\u30d0\u30a4\u30c8\u306e\u307f\u3067\u3001CRLF\u3092\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u7d42\u7aef\u3068\u3059\u308b\u3001\u975e\u5e38\u306b\u5358\u7d14\u306a\u4ed5\u69d8\u3067\u3059\u3002 \u9805\u76ee \u30c7\u30fc\u30bf\u578b \u88dc\u8db3 \u30e1\u30c3\u30bb\u30fc\u30b8\u8b58\u5225\u5b50 byte\\&lt;1> \u3000&#8217;+&#8217;, &#8216;-&#8216;, &#8216;:&#8217; \u306a\u3069 \u30e1\u30c3\u30bb\u30fc\u30b8\u90e8 &#8211; \u3000\u30e1\u30c3\u30bb\u30fc\u30b8\u7a2e\u5225\u6bce\u306b\u898f\u5b9a \u30e1\u30c3\u30bb\u30fc\u30b8\u7d42\u7aef byte\\&lt;2> CR&hellip; <\/p>\n","protected":false},"author":1,"featured_media":73,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-72","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/www.cybergarage.org\/memo\/wp-json\/wp\/v2\/posts\/72","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cybergarage.org\/memo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cybergarage.org\/memo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cybergarage.org\/memo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cybergarage.org\/memo\/wp-json\/wp\/v2\/comments?post=72"}],"version-history":[{"count":1,"href":"https:\/\/www.cybergarage.org\/memo\/wp-json\/wp\/v2\/posts\/72\/revisions"}],"predecessor-version":[{"id":74,"href":"https:\/\/www.cybergarage.org\/memo\/wp-json\/wp\/v2\/posts\/72\/revisions\/74"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cybergarage.org\/memo\/wp-json\/wp\/v2\/media\/73"}],"wp:attachment":[{"href":"https:\/\/www.cybergarage.org\/memo\/wp-json\/wp\/v2\/media?parent=72"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cybergarage.org\/memo\/wp-json\/wp\/v2\/categories?post=72"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cybergarage.org\/memo\/wp-json\/wp\/v2\/tags?post=72"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}