{"id":49078,"date":"2025-07-30T15:26:28","date_gmt":"2025-07-30T07:26:28","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/49078.html"},"modified":"2025-07-30T15:26:28","modified_gmt":"2025-07-30T07:26:28","slug":"redis%e5%bc%b1%e4%ba%8b%e5%8a%a1%e6%9c%ba%e5%88%b6%e6%b7%b1%e5%ba%a6%e5%89%96%e6%9e%90%e4%b8%8e%e5%ae%9e%e6%88%98%e6%8c%87%e5%8d%97","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/49078.html","title":{"rendered":"Redis\u5f31\u4e8b\u52a1\u673a\u5236\u6df1\u5ea6\u5256\u6790\u4e0e\u5b9e\u6218\u6307\u5357"},"content":{"rendered":"<h3>\u5f15\u8a00<\/h3>\n<p>\u5728\u6570\u636e\u5e93\u7cfb\u7edf\u4e2d&#xff0c;\u4e8b\u52a1\u662f\u4fdd\u8bc1\u6570\u636e\u4e00\u81f4\u6027\u7684\u91cd\u8981\u673a\u5236\u3002\u4e0e\u4f20\u7edf\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7684ACID\u4e8b\u52a1\u4e0d\u540c&#xff0c;Redis\u63d0\u4f9b\u4e86\u4e00\u79cd\u72ec\u7279\u7684&#034;\u5f31\u4e8b\u52a1&#034;\u673a\u5236\u3002\u8fd9\u79cd\u8bbe\u8ba1\u5728\u4fdd\u8bc1\u9ad8\u6027\u80fd\u7684\u540c\u65f6&#xff0c;\u63d0\u4f9b\u4e86\u57fa\u672c\u7684\u4e8b\u52a1\u529f\u80fd\u3002\u672c\u6587\u5c06\u6df1\u5165\u89e3\u6790Redis\u5f31\u4e8b\u52a1\u7684\u672c\u8d28\u7279\u6027\u3001\u5b9e\u73b0\u539f\u7406\u3001\u4f7f\u7528\u573a\u666f\u4ee5\u53caJava\u8bed\u8a00\u4e0b\u7684\u6700\u4f73\u5b9e\u8df5&#xff0c;\u5e2e\u52a9\u5f00\u53d1\u8005\u6b63\u786e\u7406\u89e3\u5e76\u5408\u7406\u8fd0\u7528\u8fd9\u4e00\u91cd\u8981\u7279\u6027\u3002<\/p>\n<h3>\u4e00\u3001Redis\u4e8b\u52a1\u7684\u672c\u8d28\u7279\u6027<\/h3>\n<h4>1.1 \u4ec0\u4e48\u662f\u5f31\u4e8b\u52a1<\/h4>\n<p>Redis\u7684\u4e8b\u52a1\u4e0e\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7684ACID\u4e8b\u52a1\u6709\u663e\u8457\u533a\u522b&#xff0c;\u4e3b\u8981\u4f53\u73b0\u5728&#xff1a;<\/p>\n<li>\u975e\u539f\u5b50\u6027\u4fdd\u8bc1&#xff1a;Redis\u4e8b\u52a1\u4e2d\u7684\u547d\u4ee4\u8981\u4e48\u5168\u90e8\u6267\u884c&#xff0c;\u8981\u4e48\u5168\u90e8\u4e0d\u6267\u884c&#xff0c;\u4f46\u6267\u884c\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u9519\u8bef\u65f6&#xff0c;\u5df2\u6267\u884c\u7684\u547d\u4ee4\u4e0d\u4f1a\u56de\u6eda<\/li>\n<li>\u65e0\u9694\u79bb\u7ea7\u522b&#xff1a;\u6240\u6709\u547d\u4ee4\u5728EXEC\u6267\u884c\u524d\u90fd\u4e0d\u4f1a\u5b9e\u9645\u751f\u6548&#xff0c;\u4f46\u5176\u4ed6\u5ba2\u6237\u7aef\u53ef\u4ee5\u67e5\u770b\u4e2d\u95f4\u72b6\u6001<\/li>\n<li>\u65e0\u56de\u6eda\u673a\u5236&#xff1a;\u6267\u884c\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u9519\u8bef&#xff0c;\u5df2\u6267\u884c\u7684\u547d\u4ee4\u4e0d\u4f1a\u64a4\u9500<\/li>\n<h4>1.2 Redis\u4e8b\u52a1\u7684\u4e09\u5927\u7279\u6027<\/h4>\n<ul>\n<li>\u6279\u91cf\u6267\u884c&#xff1a;\u5c06\u591a\u4e2a\u547d\u4ee4\u6253\u5305&#xff0c;\u4e00\u6b21\u6027\u987a\u5e8f\u6267\u884c<\/li>\n<li>\u9694\u79bb\u6027&#xff1a;\u4e8b\u52a1\u6267\u884c\u671f\u95f4\u4e0d\u4f1a\u88ab\u5176\u4ed6\u5ba2\u6237\u7aef\u547d\u4ee4\u6253\u65ad<\/li>\n<li>\u90e8\u5206\u539f\u5b50\u6027&#xff1a;\u5728EXEC\u6267\u884c\u524d&#xff0c;\u6240\u6709\u547d\u4ee4\u53ea\u662f\u6392\u961f&#xff0c;\u6267\u884c\u65f6\u6574\u4f53\u6267\u884c<\/li>\n<\/ul>\n<h3>\u4e8c\u3001Redis\u4e8b\u52a1\u547d\u4ee4\u8be6\u89e3<\/h3>\n<h4>2.1 \u57fa\u7840\u547d\u4ee4\u7ec4<\/h4>\n<p>MULTI      <span class=\"token comment\"># \u5f00\u542f\u4e8b\u52a1<\/span><br \/>\n<span class=\"token punctuation\">..<\/span>.\u547d\u4ee4\u961f\u5217<span class=\"token punctuation\">..<\/span>. <span class=\"token comment\"># \u8f93\u5165\u8981\u6267\u884c\u7684\u547d\u4ee4<\/span><br \/>\nEXEC       <span class=\"token comment\"># \u6267\u884c\u4e8b\u52a1<\/span><br \/>\nDISCARD    <span class=\"token comment\"># \u53d6\u6d88\u4e8b\u52a1<\/span><\/p>\n<h4>2.2 \u76d1\u63a7\u547d\u4ee4<\/h4>\n<p>WATCH key <span class=\"token punctuation\">[<\/span>key<span class=\"token punctuation\">..<\/span>.<span class=\"token punctuation\">]<\/span>  <span class=\"token comment\"># \u76d1\u63a7\u4e00\u4e2a\u6216\u591a\u4e2a\u952e<\/span><br \/>\nUNWATCH             <span class=\"token comment\"># \u53d6\u6d88\u6240\u6709\u76d1\u63a7<\/span><\/p>\n<h4>2.3 \u4e8b\u52a1\u6267\u884c\u6d41\u7a0b<\/h4>\n<li>\u5ba2\u6237\u7aef\u53d1\u9001MULTI\u547d\u4ee4<\/li>\n<li>Redis\u5c06\u540e\u7eed\u547d\u4ee4\u653e\u5165\u961f\u5217\u800c\u4e0d\u7acb\u5373\u6267\u884c<\/li>\n<li>\u5ba2\u6237\u7aef\u53d1\u9001EXEC\u547d\u4ee4<\/li>\n<li>Redis\u987a\u5e8f\u6267\u884c\u961f\u5217\u4e2d\u7684\u6240\u6709\u547d\u4ee4<\/li>\n<h3>\u4e09\u3001Redis\u4e8b\u52a1\u7684\u5c40\u9650\u6027<\/h3>\n<h4>3.1 \u4e0e\u4f20\u7edfACID\u4e8b\u52a1\u7684\u5bf9\u6bd4<\/h4>\n<table>\n<tr>\u7279\u6027Redis\u4e8b\u52a1\u4f20\u7edfACID\u4e8b\u52a1<\/tr>\n<tbody>\n<tr>\n<td>\u539f\u5b50\u6027<\/td>\n<td>\u90e8\u5206\u652f\u6301<\/td>\n<td>\u5b8c\u5168\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td>\u4e00\u81f4\u6027<\/td>\n<td>\u90e8\u5206\u652f\u6301<\/td>\n<td>\u5b8c\u5168\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td>\u9694\u79bb\u6027<\/td>\n<td>\u57fa\u672c\u652f\u6301<\/td>\n<td>\u591a\u7ea7\u522b\u652f\u6301<\/td>\n<\/tr>\n<tr>\n<td>\u6301\u4e45\u6027<\/td>\n<td>\u4f9d\u8d56\u914d\u7f6e<\/td>\n<td>\u901a\u5e38\u652f\u6301<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>3.2 \u5178\u578b\u4f7f\u7528\u9650\u5236<\/h4>\n<li>\u4e0d\u652f\u6301\u56de\u6eda&#xff1a;\u8bed\u6cd5\u9519\u8bef\u4f1a\u5bfc\u81f4\u6574\u4e2a\u4e8b\u52a1\u4e0d\u6267\u884c&#xff0c;\u4f46\u8fd0\u884c\u65f6\u9519\u8bef\u4e0d\u4f1a\u5f71\u54cd\u5df2\u6267\u884c\u7684\u547d\u4ee4<\/li>\n<li>\u65e0\u884c\u7ea7\u9501&#xff1a;\u53ea\u6709\u7b80\u5355\u7684\u4e50\u89c2\u9501\u673a\u5236(WATCH)<\/li>\n<li>\u6027\u80fd\u8003\u8651&#xff1a;\u957f\u65f6\u95f4\u7684\u4e8b\u52a1\u4f1a\u963b\u585e\u5176\u4ed6\u5ba2\u6237\u7aef<\/li>\n<h3>\u56db\u3001Java\u5b9e\u6218&#xff1a;Redis\u4e8b\u52a1\u5e94\u7528<\/h3>\n<h4>4.1 \u4f7f\u7528Jedis\u5b9e\u73b0\u57fa\u7840\u4e8b\u52a1<\/h4>\n<p><span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Jedis<\/span> jedis <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Jedis<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;localhost&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u5f00\u542f\u4e8b\u52a1<\/span><br \/>\n    <span class=\"token class-name\">Transaction<\/span> tx <span class=\"token operator\">&#061;<\/span> jedis<span class=\"token punctuation\">.<\/span><span class=\"token function\">multi<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u547d\u4ee4\u5165\u961f<\/span><br \/>\n    tx<span class=\"token punctuation\">.<\/span><span class=\"token function\">set<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;order:1&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;pending&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    tx<span class=\"token punctuation\">.<\/span><span class=\"token function\">incr<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;order:count&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u6267\u884c\u4e8b\u52a1<\/span><br \/>\n    <span class=\"token class-name\">List<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">Object<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> results <span class=\"token operator\">&#061;<\/span> tx<span class=\"token punctuation\">.<\/span><span class=\"token function\">exec<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>results <span class=\"token operator\">!&#061;<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u4e8b\u52a1\u6267\u884c\u6210\u529f&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u4e8b\u52a1\u6267\u884c\u5931\u8d25&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>4.2 \u5b9e\u73b0\u4e50\u89c2\u9501\u6a21\u5f0f<\/h4>\n<p><span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Jedis<\/span> jedis <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Jedis<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;localhost&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u76d1\u63a7\u5173\u952e\u952e<\/span><br \/>\n    jedis<span class=\"token punctuation\">.<\/span><span class=\"token function\">watch<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;inventory:count&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">int<\/span> current <span class=\"token operator\">&#061;<\/span> <span class=\"token class-name\">Integer<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">parseInt<\/span><span class=\"token punctuation\">(<\/span>jedis<span class=\"token punctuation\">.<\/span><span class=\"token function\">get<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;inventory:count&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>current <span class=\"token operator\">&gt;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">Transaction<\/span> tx <span class=\"token operator\">&#061;<\/span> jedis<span class=\"token punctuation\">.<\/span><span class=\"token function\">multi<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        tx<span class=\"token punctuation\">.<\/span><span class=\"token function\">decr<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;inventory:count&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        tx<span class=\"token punctuation\">.<\/span><span class=\"token function\">incr<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;sales:count&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">List<\/span><span class=\"token generics\"><span class=\"token punctuation\">&lt;<\/span><span class=\"token class-name\">Object<\/span><span class=\"token punctuation\">&gt;<\/span><\/span> results <span class=\"token operator\">&#061;<\/span> tx<span class=\"token punctuation\">.<\/span><span class=\"token function\">exec<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>results <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u5e93\u5b58\u5df2\u88ab\u4fee\u6539&#xff0c;\u8bf7\u91cd\u8bd5&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        jedis<span class=\"token punctuation\">.<\/span><span class=\"token function\">unwatch<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u5e93\u5b58\u4e0d\u8db3&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h3>\u4e94\u3001Redis\u4e8b\u52a1\u6700\u4f73\u5b9e\u8df5<\/h3>\n<h4>5.1 \u9002\u7528\u573a\u666f<\/h4>\n<li>\u6279\u91cf\u64cd\u4f5c\u9700\u8981\u539f\u5b50\u6027\u6267\u884c\u7684\u573a\u666f<\/li>\n<li>\u7b80\u5355\u7684\u4e50\u89c2\u9501\u5b9e\u73b0<\/li>\n<li>\u975e\u5173\u952e\u4e1a\u52a1\u6d41\u7a0b\u4e2d\u7684\u4e00\u81f4\u6027\u4fdd\u8bc1<\/li>\n<h4>5.2 \u907f\u5751\u6307\u5357<\/h4>\n<li>\u907f\u514d\u5927\u4e8b\u52a1&#xff1a;\u4e8b\u52a1\u4e2d\u7684\u547d\u4ee4\u8fc7\u591a\u4f1a\u963b\u585eRedis<\/li>\n<li>\u5408\u7406\u4f7f\u7528WATCH&#xff1a;\u76d1\u63a7\u8fc7\u591a\u952e\u4f1a\u5f71\u54cd\u6027\u80fd<\/li>\n<li>\u9519\u8bef\u5904\u7406&#xff1a;\u603b\u662f\u68c0\u67e5EXEC\u8fd4\u56de\u7ed3\u679c<\/li>\n<li>\u7ba1\u9053\u4f18\u5316&#xff1a;\u7ed3\u5408\u7ba1\u9053(pipeline)\u63d0\u5347\u6027\u80fd<\/li>\n<h4>5.3 \u6027\u80fd\u4f18\u5316\u5efa\u8bae<\/h4>\n<p><span class=\"token comment\">\/\/ \u4f7f\u7528\u7ba1\u9053&#043;\u4e8b\u52a1\u7684\u7ec4\u5408<\/span><br \/>\n<span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Jedis<\/span> jedis <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Jedis<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;localhost&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token class-name\">Pipeline<\/span> pipeline <span class=\"token operator\">&#061;<\/span> jedis<span class=\"token punctuation\">.<\/span><span class=\"token function\">pipelined<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    pipeline<span class=\"token punctuation\">.<\/span><span class=\"token function\">multi<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    pipeline<span class=\"token punctuation\">.<\/span><span class=\"token function\">set<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;k1&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;v1&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    pipeline<span class=\"token punctuation\">.<\/span><span class=\"token function\">set<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;k2&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;v2&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    pipeline<span class=\"token punctuation\">.<\/span><span class=\"token function\">exec<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    pipeline<span class=\"token punctuation\">.<\/span><span class=\"token function\">sync<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h3>\u516d\u3001Redis\u4e8b\u52a1\u4e0eLua\u811a\u672c<\/h3>\n<p>\u5bf9\u4e8e\u590d\u6742\u7684\u4e8b\u52a1\u9700\u6c42&#xff0c;\u53ef\u4ee5\u8003\u8651\u4f7f\u7528Lua\u811a\u672c&#xff1a;<\/p>\n<p><span class=\"token class-name\">String<\/span> luaScript <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;if redis.call(&#039;get&#039;, KEYS[1]) &#061;&#061; ARGV[1] then &#034;<\/span> <span class=\"token operator\">&#043;<\/span><br \/>\n                   <span class=\"token string\">&#034;return redis.call(&#039;set&#039;, KEYS[1], ARGV[2]) &#034;<\/span> <span class=\"token operator\">&#043;<\/span><br \/>\n                   <span class=\"token string\">&#034;else return 0 end&#034;<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Jedis<\/span> jedis <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Jedis<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;localhost&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token class-name\">Object<\/span> result <span class=\"token operator\">&#061;<\/span> jedis<span class=\"token punctuation\">.<\/span><span class=\"token function\">eval<\/span><span class=\"token punctuation\">(<\/span>luaScript<span class=\"token punctuation\">,<\/span><br \/>\n                              <span class=\"token class-name\">Collections<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">singletonList<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;key&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                              <span class=\"token class-name\">Arrays<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">asList<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;oldValue&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;newValue&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>Lua\u811a\u672c\u7684\u4f18\u52bf&#xff1a;<\/p>\n<ul>\n<li>\u539f\u5b50\u6027\u6267\u884c<\/li>\n<li>\u51cf\u5c11\u7f51\u7edc\u5f00\u9500<\/li>\n<li>\u907f\u514dWATCH\u7684\u7ade\u4e89\u6761\u4ef6<\/li>\n<\/ul>\n<h3>\u7ed3\u8bed<\/h3>\n<p>Redis\u7684\u5f31\u4e8b\u52a1\u673a\u5236\u662f\u5176\u9ad8\u6027\u80fd\u8bbe\u8ba1\u7684\u91cd\u8981\u4f53\u73b0&#xff0c;\u867d\u7136\u4e0d\u80fd\u63d0\u4f9b\u4f20\u7edf\u6570\u636e\u5e93\u7684\u5b8c\u6574ACID\u4fdd\u8bc1&#xff0c;\u4f46\u5728\u9002\u5f53\u7684\u573a\u666f\u4e0b\u4ecd\u7136\u662f\u975e\u5e38\u6709\u4ef7\u503c\u7684\u5de5\u5177\u3002\u7406\u89e3\u5176\u5de5\u4f5c\u539f\u7406\u548c\u5c40\u9650\u6027&#xff0c;\u7ed3\u5408\u4e1a\u52a1\u9700\u6c42\u5408\u7406\u9009\u62e9\u4e8b\u52a1\u3001\u4e50\u89c2\u9501\u6216Lua\u811a\u672c&#xff0c;\u624d\u80fd\u5145\u5206\u53d1\u6325Redis\u7684\u4f18\u52bf\u3002<\/p>\n<p>\u5982\u9700\u83b7\u53d6\u66f4\u591a\u5173\u4e8e Redis \u6570\u636e\u7ed3\u6784\u4f18\u5316\u3001\u9ad8\u5e76\u53d1\u5b9e\u8df5\u3001\u6301\u4e45\u5316\u673a\u5236\u3001\u96c6\u7fa4\u90e8\u7f72\u7b49\u5185\u5bb9&#xff0c;\u8bf7\u6301\u7eed\u5173\u6ce8\u672c\u4e13\u680f\u300aRedis \u8fdb\u9636\u4e0e\u5b9e\u6218\u300b\u7cfb\u5217\u6587\u7ae0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb2.1k\u6b21\uff0c\u70b9\u8d5e79\u6b21\uff0c\u6536\u85cf16\u6b21\u3002\u975e\u539f\u5b50\u6027\u4fdd\u8bc1\uff1aRedis\u4e8b\u52a1\u4e2d\u7684\u547d\u4ee4\u8981\u4e48\u5168\u90e8\u6267\u884c\uff0c\u8981\u4e48\u5168\u90e8\u4e0d\u6267\u884c\uff0c\u4f46\u6267\u884c\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u9519\u8bef\u65f6\uff0c\u5df2\u6267\u884c\u7684\u547d\u4ee4\u4e0d\u4f1a\u56de\u6eda\u65e0\u9694\u79bb\u7ea7\u522b\uff1a\u6240\u6709\u547d\u4ee4\u5728EXEC\u6267\u884c\u524d\u90fd\u4e0d\u4f1a\u5b9e\u9645\u751f\u6548\uff0c\u4f46\u5176\u4ed6\u5ba2\u6237\u7aef\u53ef\u4ee5\u67e5\u770b\u4e2d\u95f4\u72b6\u6001\u65e0\u56de\u6eda\u673a\u5236\uff1a\u6267\u884c\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u9519\u8bef\uff0c\u5df2\u6267\u884c\u7684\u547d\u4ee4\u4e0d\u4f1a\u64a4\u9500Redis\u7684\u5f31\u4e8b\u52a1\u673a\u5236\u662f\u5176\u9ad8\u6027\u80fd\u8bbe\u8ba1\u7684\u91cd\u8981\u4f53\u73b0\uff0c\u867d\u7136\u4e0d\u80fd\u63d0\u4f9b\u4f20\u7edf\u6570\u636e\u5e93\u7684\u5b8c\u6574ACID\u4fdd\u8bc1\uff0c\u4f46\u5728\u9002\u5f53\u7684\u573a\u666f\u4e0b\u4ecd\u7136\u662f\u975e\u5e38\u6709\u4ef7\u503c\u7684\u5de5\u5177\u3002\u7406\u89e3\u5176\u5de5\u4f5c\u539f\u7406\u548c\u5c40\u9650\u6027\uff0c\u7ed3\u5408\u4e1a\u52a1\u9700\u6c42\u5408\u7406\u9009\u62e9\u4e8b\u52a1\u3001\u4e50\u89c2\u9501\u6216Lua\u811a\u672c\uff0c\u624d\u80fd\u5145\u5206\u53d1\u6325Redis\u7684\u4f18\u52bf\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[105,4750,4751],"topic":[],"class_list":{"0":"post-49078","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-server","7":"tag-redis","9":"tag-4751"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Redis\u5f31\u4e8b\u52a1\u673a\u5236\u6df1\u5ea6\u5256\u6790\u4e0e\u5b9e\u6218\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/49078.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Redis\u5f31\u4e8b\u52a1\u673a\u5236\u6df1\u5ea6\u5256\u6790\u4e0e\u5b9e\u6218\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb2.1k\u6b21\uff0c\u70b9\u8d5e79\u6b21\uff0c\u6536\u85cf16\u6b21\u3002\u975e\u539f\u5b50\u6027\u4fdd\u8bc1\uff1aRedis\u4e8b\u52a1\u4e2d\u7684\u547d\u4ee4\u8981\u4e48\u5168\u90e8\u6267\u884c\uff0c\u8981\u4e48\u5168\u90e8\u4e0d\u6267\u884c\uff0c\u4f46\u6267\u884c\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u9519\u8bef\u65f6\uff0c\u5df2\u6267\u884c\u7684\u547d\u4ee4\u4e0d\u4f1a\u56de\u6eda\u65e0\u9694\u79bb\u7ea7\u522b\uff1a\u6240\u6709\u547d\u4ee4\u5728EXEC\u6267\u884c\u524d\u90fd\u4e0d\u4f1a\u5b9e\u9645\u751f\u6548\uff0c\u4f46\u5176\u4ed6\u5ba2\u6237\u7aef\u53ef\u4ee5\u67e5\u770b\u4e2d\u95f4\u72b6\u6001\u65e0\u56de\u6eda\u673a\u5236\uff1a\u6267\u884c\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u9519\u8bef\uff0c\u5df2\u6267\u884c\u7684\u547d\u4ee4\u4e0d\u4f1a\u64a4\u9500Redis\u7684\u5f31\u4e8b\u52a1\u673a\u5236\u662f\u5176\u9ad8\u6027\u80fd\u8bbe\u8ba1\u7684\u91cd\u8981\u4f53\u73b0\uff0c\u867d\u7136\u4e0d\u80fd\u63d0\u4f9b\u4f20\u7edf\u6570\u636e\u5e93\u7684\u5b8c\u6574ACID\u4fdd\u8bc1\uff0c\u4f46\u5728\u9002\u5f53\u7684\u573a\u666f\u4e0b\u4ecd\u7136\u662f\u975e\u5e38\u6709\u4ef7\u503c\u7684\u5de5\u5177\u3002\u7406\u89e3\u5176\u5de5\u4f5c\u539f\u7406\u548c\u5c40\u9650\u6027\uff0c\u7ed3\u5408\u4e1a\u52a1\u9700\u6c42\u5408\u7406\u9009\u62e9\u4e8b\u52a1\u3001\u4e50\u89c2\u9501\u6216Lua\u811a\u672c\uff0c\u624d\u80fd\u5145\u5206\u53d1\u6325Redis\u7684\u4f18\u52bf\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/49078.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-30T07:26:28+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/49078.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/49078.html\",\"name\":\"Redis\u5f31\u4e8b\u52a1\u673a\u5236\u6df1\u5ea6\u5256\u6790\u4e0e\u5b9e\u6218\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-30T07:26:28+00:00\",\"dateModified\":\"2025-07-30T07:26:28+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/49078.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/49078.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/49078.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Redis\u5f31\u4e8b\u52a1\u673a\u5236\u6df1\u5ea6\u5256\u6790\u4e0e\u5b9e\u6218\u6307\u5357\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Redis\u5f31\u4e8b\u52a1\u673a\u5236\u6df1\u5ea6\u5256\u6790\u4e0e\u5b9e\u6218\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/49078.html","og_locale":"zh_CN","og_type":"article","og_title":"Redis\u5f31\u4e8b\u52a1\u673a\u5236\u6df1\u5ea6\u5256\u6790\u4e0e\u5b9e\u6218\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb2.1k\u6b21\uff0c\u70b9\u8d5e79\u6b21\uff0c\u6536\u85cf16\u6b21\u3002\u975e\u539f\u5b50\u6027\u4fdd\u8bc1\uff1aRedis\u4e8b\u52a1\u4e2d\u7684\u547d\u4ee4\u8981\u4e48\u5168\u90e8\u6267\u884c\uff0c\u8981\u4e48\u5168\u90e8\u4e0d\u6267\u884c\uff0c\u4f46\u6267\u884c\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u9519\u8bef\u65f6\uff0c\u5df2\u6267\u884c\u7684\u547d\u4ee4\u4e0d\u4f1a\u56de\u6eda\u65e0\u9694\u79bb\u7ea7\u522b\uff1a\u6240\u6709\u547d\u4ee4\u5728EXEC\u6267\u884c\u524d\u90fd\u4e0d\u4f1a\u5b9e\u9645\u751f\u6548\uff0c\u4f46\u5176\u4ed6\u5ba2\u6237\u7aef\u53ef\u4ee5\u67e5\u770b\u4e2d\u95f4\u72b6\u6001\u65e0\u56de\u6eda\u673a\u5236\uff1a\u6267\u884c\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u9519\u8bef\uff0c\u5df2\u6267\u884c\u7684\u547d\u4ee4\u4e0d\u4f1a\u64a4\u9500Redis\u7684\u5f31\u4e8b\u52a1\u673a\u5236\u662f\u5176\u9ad8\u6027\u80fd\u8bbe\u8ba1\u7684\u91cd\u8981\u4f53\u73b0\uff0c\u867d\u7136\u4e0d\u80fd\u63d0\u4f9b\u4f20\u7edf\u6570\u636e\u5e93\u7684\u5b8c\u6574ACID\u4fdd\u8bc1\uff0c\u4f46\u5728\u9002\u5f53\u7684\u573a\u666f\u4e0b\u4ecd\u7136\u662f\u975e\u5e38\u6709\u4ef7\u503c\u7684\u5de5\u5177\u3002\u7406\u89e3\u5176\u5de5\u4f5c\u539f\u7406\u548c\u5c40\u9650\u6027\uff0c\u7ed3\u5408\u4e1a\u52a1\u9700\u6c42\u5408\u7406\u9009\u62e9\u4e8b\u52a1\u3001\u4e50\u89c2\u9501\u6216Lua\u811a\u672c\uff0c\u624d\u80fd\u5145\u5206\u53d1\u6325Redis\u7684\u4f18\u52bf\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/49078.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-30T07:26:28+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/49078.html","url":"https:\/\/www.wsisp.com\/helps\/49078.html","name":"Redis\u5f31\u4e8b\u52a1\u673a\u5236\u6df1\u5ea6\u5256\u6790\u4e0e\u5b9e\u6218\u6307\u5357 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-30T07:26:28+00:00","dateModified":"2025-07-30T07:26:28+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/49078.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/49078.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/49078.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Redis\u5f31\u4e8b\u52a1\u673a\u5236\u6df1\u5ea6\u5256\u6790\u4e0e\u5b9e\u6218\u6307\u5357"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/49078","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=49078"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/49078\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=49078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=49078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=49078"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=49078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}